Puzzle: Identify standalone Android devices

Source: Internet
Author: User

It took me some time to figure out how I could identify a standalone Android phone today by chance my friend asked.
In fact, this question can be a second answer, is the IMEI.

TelephonyManager.getDeviceId();

This requires a permission:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

If the problem is so simple, the problem is:

    • Other devices such as tablets, no SIM card, so no telephony module.
    • Some device factory reset operation will empty the IMEI (the result is usually caused by the hard solution of parallel imports)
      • Refer to this hard solution technology sticker
      • Refer to this factory reset careless operation case
    • Many cottage phone manufacturers in China lazy, brush machine does not change the IMEI, so the IMEI is the same

So the problem actually starts here. The following are some of the solutions that can be found online:

-WIFI MAC

One solution is to take the IMEI first, when the IMEI is the same, then compare the WiFi MAC address. However, if the phone does not have WiFi function or WiFi function is not turned on (airplane mode), you cannot get the MAC address. More people melancholy is, China's big cottage manufacturers are really lazy, the MAC address of the wireless network card is also not modified, a lot of self-brush machine is also the condition (such as this, this and this). As far as Bluetooth MAC address is, let alone. The cause of the IMEI repeat, and the same as the MAC address is actually a reason, are brush or cottage, so this WiFi MAC address scheme is not complementary, you must seek another way.

-Serial NO

Another option is to use serial NO. This value is only supported on Android version 2.3. This can be viewed through the ADB:

adb shell getprop ro.serialno

The code can be accessed using system variable Android.os.Build.SERIAL. This is the best way to go after the IMEI if this value can be taken. The disadvantage is that this value is not supported on Android systems with versions 2.2 and below. But fortunately today's Android world's share of 2.2 and below is getting lower and faster, so this value is worth a try.

-Android ID

In fact, the Android system provides Settings.Secure.ANDROID_ID to get the unique device number.

import android.provider.Settings.Secure;private String android_id = Secure.getString(                            getContext().getContentResolver(),                            

But the same 2.2 systems were not well supported. This value is generated after the initial boot of the system, so this value will change after factory reset, resulting in a virtual high number of devices observed. In the mobile phone brush, reset the frequent environment, this value is not reliable. In addition, a factory production equipment actually has a bug, this value will be repeated (DROID2), so this value is not used as good.

-Generated UUID

Finally there is a self-generated UUID method, save this ID, each time you visit the server upload, and tell the system themselves who. This method is more unreliable than all hardware methods, because simply uninstalling the software and cleaning up the data will cause this value to be deleted, resulting in a new UUID, resulting in a virtual high number of devices being observed. Let alone brush the machine and restore the factory settings. This method is ideal for counting the number of software installations, not individual devices.

Conclusion

In summary, so far I have not found a very perfect statistical independent equipment, especially in China this parallel imports, hard solutions, cottage, brush machine market flooding and irregular Android world, it is even more difficult.

But in turn, is not a completely refreshed, installed a new ROM phone, it is not the original phone? What is the purpose of counting the number of independent devices? If you want the number of independent active devices, actually with their own generated UUID is sufficient, because the original use of the UUID has been inactive, can be ignored. For app developers, the situation is the same as when the user has switched to a mobile phone, completely discarding the old one. In the case of active UUID, it would be advisable to use android_id or a UUID of your own generation.

From

Http://www.hawkwithwind.net/blog/2013/04/24/%E9%9A%BE%E9%A2%98%EF%BC%9A%E8%AF%86%E5%88%AB%E7%8B%AC%E7%AB%8B%E5 %ae%89%e5%8d%93%e8%ae%be%e5%a4%87/

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.