How do I uniquely identify an android device?

Source: Internet
Author: User
Tags unique id uuid

UUID : (Universally unique Identifier) Globally unique identifier, refers to the number generated on a machine, which guarantees that all machines in the same time and space are unique. A combination of the following: the current date and time (the first part of the UUID is related to the time, if you generate a UUID after a few seconds, the first part is different, the rest is the same), the clock sequence, the globally unique IEEE Machine identification number (if there is a network card, from the network card, No network card is available in other ways).

IMEI : (International Mobile Equipment Identity) is an abbreviation for International mobile device Identification Code, international Mobile Equipment Identification Code, is a 15-digit "electronic serial number", which corresponds to one by one of each mobile phone, And the code is the only one in the world.

MEID : (Mobile Equipment IDentifier) is the world's only 56bit CDMA mobile terminal identification number. The identification number is burned into the terminal and cannot be modified. It can be used for identification and tracking of CDMA mobile devices.

The difference between the two is: the IMEI is the ID card of the mobile phone, Meid is the CDMA format (telecommunications operation) of the special identity card; the IMEI is 15 bits and Meid is 14 bits.

device_id

Depending on the phone device returned Imei,meid or ESN code, can be obtained according to the following code:


device_id

Non-mobile devices: Android devices are the first to be installed, and now there are non-mobile devices: such as tablets, TVs, music players and so on. These devices do not have the hardware function of the call, there is no telephony_service in the system, and naturally it is impossible to obtain device_id by the above method.

Permissions issue: Obtaining device_id requires Read_phone_state permissions, the mechanism for dynamically granting permissions on Android 6.0 using the runtime, and will not get device_id once the user is not granted authorization.

Bug in vendor-specific system: a few mobile devices, because of the implementation of the loopholes, will return garbage (this is the developer blog's words, not practice).

MAC ADDRESS
Mac_address

You can use your phone's WiFi or Bluetooth MAC address as your device ID, but this is not recommended for the following two reasons:

Hardware limitations: Not all devices have WiFi and Bluetooth hardware, the hardware does not exist naturally will not get this information.

Gets the limit: If WiFi is not turned on, it cannot get its MAC address, while Bluetooth is only available when it is opened to its MAC address.

Serial Number

Hardware sequence, the serial number can be obtained by Android.os.Build.SERIAL over Android 2.2. Some devices that do not have a phone feature will be available, and some phones may also be available (so it is often returned unknown)

android_id

ANDROID_ID is the number of 64bit that is generated and stored when the device is first started and resets after the device is wipe.


android_id

ANDROID_ID seems like a good choice to get a device ID, but it's also flawed: there's a very common bug in the devices that mainstream manufacturers produce, which is that every device produces the same android_id:9774d56d682e549c. At the same time, the value of the android_id can be changed when the machine is being brushed or reset.

the next step is to look at the actual identification method:First type: installtion ID

An ID is generated the first time it is run after a program is installed, which differs from the device's unique identity, and different applications produce different IDs, and the same program can be reinstalled differently. so this is not the device's unique ID, but it guarantees that each user's ID will be different . It can be said to be used to identify the unique ID of each application (that is, the Installtion ID), can be used to track the number of installs of the application (in fact, the UUID).


Installtion Id Get methodThe second type: uniquepsuedoid

By reading the device's ROM version number, vendor name, CPU model and other hardware information to assemble a string of 15-bit number and device hardware serial number as the seed generation UUID. A string of 15-bit numbers (mass production equipment each information is basically the same, so this section of the same probability is particularly high); hardware sequences, which are available in some devices that do not have a phone function, may also be available on some phones (Devices without telephony is required to Report a unique device ID here; Some phones may does so also, and so is often returned unknown.


Uniquepsuedoid Get MethodThe third type: Universal ID

First, by reading android_id, as the seed of the UUID. If the obtained android_id equals 9774d56d682e549c or an error occurs, the random UUID is used as a fallback scheme, and the resulting UUID is stored in both internal and external storage at the same time. The next time the UUID is used, it is read first from the external storage, then read from the back, and finally regenerated, as much as possible to ensure its invariance.


Universal_id Get method

Reference Document: Http://android-developers.blogspot.jp/2011/03/identifying-app-installations.html


Source: Http://www.jianshu.com/p/178786f833b6

From for notes (Wiz)

How do I uniquely identify an android device?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.