简体   繁体   English

Android设备可以开始为设备ID提供空值吗?

[英]Can a android device start giving null value for device id?

I have an app on the market. 我在市场上有一个应用程序。 When you start playing your device id is linked to your account so you don't have to log in manually. 当您开始播放时,您的设备ID会链接到您的帐户,因此您无需手动登录。 For some time now a few people had a problem. 一段时间以来,有些人遇到了问题。 They started logging in into different accounts. 他们开始登录到不同的帐户。 What seems to be the problem is that some devices give a null value when asked for device id. 问题似乎在于,某些设备在询问设备ID时会给出空值。 With a few accounts with a null device id, people were logging into different accounts. 使用一些设备ID为空的帐户,人们正在登录不同的帐户。

I read that some devices will do that. 我读到有些设备会这样做。 But it seems that there was no problem during account creation and then playing for a while. 但是似乎在创建帐户并播放一段时间后没有问题。

I know this is not the best method and google discourages using device ids since they can change on fabric reset. 我知道这不是最好的方法,Google不鼓励使用设备ID,因为设备ID可以在架构重置时更改。

Can a device for some reason stop giving its id(besides the fabric reset)? 设备是否可以出于某种原因停止提供其ID(除了重置结构外)? Anyone know of a different way to identify the user with out him needing to put in a login or password? 有谁知道用其他方法来识别用户,而无需输入登录名或密码?

Yes some phones have bugs in them where they will return NULL for Android ID. 是的,有些手机有错误,他们将为Android ID返回NULL。 I think if you want to continue to use them you'll always need a way to tie that handset to an account, email, username. 我认为,如果您想继续使用它们,将始终需要将手机绑定到帐户,电子邮件和用户名的方法。 That way if the Android ID is unrecognized they could login using their email or username, and password to associate them again. 这样,如果无法识别Android ID,则可以使用其电子邮件或用户名以及密码重新登录以重新关联它们。 You'll always have issues where someone buys a new phone and needs a way recover their account if you don't. 如果有人不买新手机,您总是会遇到问题,他们需要一种方法来恢复他们的帐户。

A better option is every Android phone is attached to a Google account. 更好的选择是每个Android手机都附加到Google帐户。 And using the AccountManager class you can use those credentials to authenticate to your software automatically and the user doesn't have to enter username/password. 使用AccountManager类,您可以使用这些凭据自动对您的软件进行身份验证,而用户不必输入用户名/密码。 And you'e centralized their identity. 并且你集中了他们的身份。 Also with this method you don't require the extra permissions to read data that has potential security issues too. 同样,使用这种方法,您也不需要额外的权限即可读取存在潜在安全问题的数据。

You could create a random UUID after the user has installed your app. 用户安装您的应用程序后,您可以创建一个随机UUID。

Do not use hardware ids, because not every type of hardware is found in every type of Android device. 不要使用硬件ID,因为并非每种类型的Android设备都能找到所有类型的硬件。 Another reason not to use them is, if someone sells his phone, the user changes but the device id not! 不使用它们的另一个原因是,如果有人出售他的手机,用户会更改,但设备ID不会! This has serious privacy and usability implications you do not want to have. 这具有您不希望拥有的严重的隐私和可用性隐患。

See the talk Android Protips (from google io 2011). 请参阅Android Protips (来自google io 2011)。 Tune in at 15:00 to see more reasons and a detailed descriptions on how to use random UUIDs for your usecase. 在15:00收听,以查看更多原因以及有关如何在用例中使用随机UUID的详细说明。

I am facing the same problem In my case when first install the app it is giving null id . 我面临同样的问题在我的情况下,当第一次安装应用程序时,它给出了null id。 but after that it is giving me all three IMEI, ANDROID_ID and deviceID. 但之后它给了我所有三个IMEI,ANDROID_ID和deviceID。

BTW, you can find the ways to identify the devices here 顺便说一句,您可以在这里找到识别设备的方法

http://innovator.samsungmobile.com/cms/cnts/knowledge.detail.view.do?platformId=1&cntsId=9640 http://innovator.samsungmobile.com/cms/cnts/knowledge.detail.view.do?platformId=1&cntsId=9640

另外,一些研究原型试图阻止电话收集这些信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM