Explain several ways for Android to obtain the unique ID of the device

Let's take a look at several simple methods:

IMEI

Method: telephonymanager. Getdeviceid():

problem

MAC address

ACCESS_ WIFI_ State permission

Some devices are not allowed without WiFi or Bluetooth. If WiFi is not turned on, the hardware will not return the MAC address. It is not recommended to use it

ANDROID_ The system in ID 2.2 (Froyo, 8) is not trusted. Mainstream mobile phones from major manufacturers have at least one commonly found bug. These problematic mobile phones have the same Android_ ID: 9774d56d682e549c

However, if the mobile phone is returned to the factory or the mobile phone is root, it may change

Serial Number

Available from Android 2.3 ("Gingerbread"), it can be obtained through android.os.build.serial. For devices without call function, it will return a unique device ID,

The following are some of the more commented ones on stackoverflow, but they haven't finished posting. There are others, comprehensive, using some of the above methods:

Address: http://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id

Interested friends can take a closer look

Those with high support rate (157 votes): Android -- > eliminates the problematic mobile phones in version 2.2 (API 8) and uses UUID instead

Judgment method based on version: serial serial serial number -- > UUID (number of supported 31)

You can use serial. In terms of coverage, you have successfully obtained 98.4% of users, and the remaining 1.6% of users are under 9.

As mentioned earlier, on 8, some businesses' mobile phones will have some bugs and return the same androidid. If both serial and androidid fail

No read_ PHONE_ Method of obtaining ROM information directly with state permission: (low support rate 16)

Finally, post your own in the project:

There is no absolute scheme for obtaining the unique ID of the device, which is also mentioned in the official blog of Android. However, the above schemes should meet the usual needs. You can choose what you think is better for your own projects.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>