Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android device id confusion

If I dial * # * # 8 2 5 5 # * # * , I get my android device id which starts with android-35c2acdd...

sourcesource

If I use Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID) the result starts with a96b4b27...

If I use ((TelephonyManager) Context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId() the result starts with 3538330...

What is the difference between these ID-s? How can I get the result of the

* # * # 8 2 5 5 # * # * dial?

like image 297
Gergely Fehérvári Avatar asked Dec 06 '12 13:12

Gergely Fehérvári


People also ask

Does device ID change in Android?

You'll have to fully format your device data to change your Android phone's device ID. As the device ID is generated when you first set up the device, resetting the phone will change the Android device ID automatically.

Is Android device ID unique?

Secure#ANDROID_ID returns the Android ID as an unique for each user 64-bit hex string. It's known to be null sometimes, it's documented as "can change upon factory reset". Use at your own risk, and it can be easily changed on a rooted phone.

What does device ID tell you?

A device ID is a unique, anonymous identifier assigned to a device—such as a smartphone, tablet, or laptop—whose apps can then access it. This device ID number is not only used by developers to collect anonymous data about the performance of their iOS or Android apps but is also used for targeted advertising.

Is device ID the same as IMEI?

A device ID is a unique 16-byte number used to uniquely identify a device within OEM Cloud. Most device IDs are derived from the device MAC address, IMEI number, or ESN number. If a device does not have an assigned MAC, IMEI, or ESN, OEM Cloud generates and assigns a random 16-byte number for the device ID.


1 Answers

IMEI

The IMEI is the 'MAC' for the telephony module - the unique ID that the telephone uses when it connects via GSM/GPRS/HSPDA/etc. The GSM network uses it to route calls and data from the phone over the GSM network right up to the gateway into the Internet (which is an IP network).

A telephony module is a chip or circuit board that handles the telephone network, either GSM or CMDA, and often has a slot for a removable SIM card. Some phones have more than one telephony module (active dual- or multi-SIM phones). Each telephony module has its own IMEI.

Manufacturers give each phone (strictly the telephony module) a unique IMEI during manufacturing. However the number can normally be rewritten if you have the right software. This is often done after a phone has been stolen to give the phone a new identity and bipass stolen phone blocking system.

The IMEI can be programmatically obtained using the TelephonyManager.getDeviceId() API.

CDMA phones have a ESN or MEID which are different lengths and formats, even though it is retrieved using the same API.

Android devices without telephony modules - for example many tablets and TV devices - do not have an IMEI. As Schlangi commented, some devices that do not have a telephony module fake the IMEI, so the presence of an IMEI does not (always) guarantee the device has a telephony module.

ANDROID_ID

The ANDROID_ID is another unique number on the phone - this is automatically generated by the OS as it boots for the first time (doing it this way makes it much easier for the manufacturers by removing a step from the production line).

The ANDROID_ID can (and does) change, for example:

  • Factory reset (including when reflashing the OS)
  • In software: eg https://play.google.com/store/apps/details?id=com.vcastroi.changeid

It is mainly used by developers (eg identifying and connecting to devices using adb)

ANDROID_ID can be used to identify an Android device given the caveats above, realistically meaning that it uniquely identifies the device over significant portions of the device lifetime, but cannot be relied on.

Also note that there was a bug in Froyo where many devices gave themselves the same ANDROID_ID. This is the bug

Other identifiers

There are a number of other things that can be used identify the device:

  • MAC address of the WiFi module: WifiManager.getConnectionInfo() -> WifiInfo.getMacAddress(). This can often be changed in software, but generally is constant over the device lifetime. Also it can only be read if the WiFi module is switched on.
  • MAC address of the BlueTooth module: BluetoothAdaptor.getAddress(). Like WiFi MAC, this can often be changed in software and may be off when you need it
  • The subscriber's telephone number. This may change if the user requests a new number from the telco, or if the user switches SIMs. It is obtained from TelephonyManager.getLine1Number(). This is only present for Android phone devices with a current SIM installed and a paid service with a telco.
  • The SIM contains its own identifying number (IMSI). This is obtained from the TelephonyManager.getSubscriberId() API. Obviously the SIM may not be present at any specific time, and it changes when the SIM is changed - and users can upgrade/replace their SIM while keeping the same number, so you can't say that this is one-to-one to a specific phone or user.
  • Related to the IMSI is the MSISDN. This functions as the identification of a subscription (your contract for a specific telephone number with your mobile provider) and therefore gives the device its telephone number. The MSISDN may be associated with several SIM cards, and therefore several phones. It comes with all the caveats for reading the SIM above. This may be retrieved with TelephonyManager.getSimSerialNumber(). Thanks Schlangi for the corrections and additions
  • Gingerbread and later has android.os.Build.SERIAL which many manufacturers set (but not all. Bugger).

Other notes

You need specific permissions to access each and every API, so if you try for all of them, your app's permissions in the Google Play store look fairly permissive.

I think this link explains all the other available options also https://android-developers.googleblog.com/2011/03/identifying-app-installations.html

like image 176
Andrew Alcock Avatar answered Oct 05 '22 14:10

Andrew Alcock