简体   繁体   中英

Android : Unique Id for android device to identify the unique device

I need an ID which will not change for android device and it should be unique at any time even if WIFI, SIM, Bluetooth are not present as well as when user reset his/her phone or flash with new OS.

I know about these Id. IMEI : It is not available for all device(Ex. SIM less device).

MAC : Is is not available for all device(Ex. WIFI less device).

Android Id : It changed when user Reset his/her phone or device is root with new OS.

Which will be better for my requirement?

Should I used Serial Id. Build.SERIAL??

You could use a combination of manufacturer info, device name and serial. This should be unique and available over all devices:

StringBuilder sb = new StringBuilder();

sb.append(android.os.Build.MANUFACTURER);
sb.append(" ");
sb.append(android.os.Build.MODEL);
sb.append(" ");
sb.append(android.os.Build.SERIAL);

String unique = sb.toString();

Please check this link below right from android developers blog. http://android-developers.blogspot.in/2011/03/identifying-app-installations.html

Copying specific details from the link to answer your question.

For the vast majority of applications, the requirement is to identify a particular installation, not a physical device. Fortunately, doing so is straightforward.

There are many good reasons for avoiding the attempt to identify a particular device. For those who want to try, the best approach is probably the use of ANDROID_ID on anything reasonably modern, with some fallback heuristics for legacy devices.

If your requirement is to uniquely identify each user generating UUID for each user and storing it on server would do. But if you really want to get physical device unique identifier, ANDORID_ID looks to be the only probable way.

Having said that, Please be aware of this bug (and how android_id is different for different profiles on same device).

http://code.google.com/p/android/issues/detail?id=42523

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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