Device ID:
- A device ID (device identification) is a distinctive number associated with a smartphone or similar handheld device.
- Device IDs are separate from hardware serial numbers.
How do find my android device ID?
- Dial *#06#. The number should display on our screen.
- The IMEI / IMSI / MEID is displayed in the device’s phone status setting.
- The ID may be under or below the battery or on the back or bottom of the device.
- Use the number “0” instead of the letter “o”. Close.
Android ID:
Device ID:
[ad type=”banner”]- DeviceID: This is the serial of the device, which should persist even a factory reset.
- AndroidID: This will be set at the first boot (either with a brand new device, or after a factory reset). As implicated, it does not survive a factory-reset
- There’s a second “Android_ID” which is generated and used by the Google Services Framework (GSF), and thus often referenced as “GSF ID”. Behaves basically like the AndroidID mentioned before (e.g. doesn’t survive a factory-reset), and co-exists with it.
- Furthermore, there’s the GAID (Google Advertising ID), which can be reset by the user via the Google Settings app.
- During “normal operation” (i.e. as long as you not factory-reset your device or reset the GAID), all these IDs can be used to identify the device. When using multiple users (via user profiles) on a device, all except the DeviceID would even identify the user (profile).
Tenets of Working with Android Identifiers
#: Avoid using hardware identifiers. Hardware identifiers such as SSAID (Android ID) and IMEI can be avoided in most use-cases without limiting required functionality.
#: Only use Advertising ID for user profiling or ads use-cases. When using an Advertising ID, always respect the Limit Ad Tracking flag, ensure the identifier cannot be connected to personally identifiable information (PII) and avoid bridging Advertising ID resets.
#: Use an Instance ID or a privately stored GUID whenever possible for all other use-cases except payment fraud prevention and telephony. For the vast majority of non-ads use-cases, an instance ID or GUID should be sufficient.
#: Use APIs that are appropriate to your use-case to minimize privacy risk. Use the DRM API API for high value content protection and the SafetyNet API for abuse prevention. The Safetynet API is the easiest way to determine whether a device is genuine without incurring privacy risk.
Settings.Secure#ANDROID_ID returns the Android ID as an unique for each user 64-bit hex string.
[ad type=”banner”]- All devices tested returned a value for TelephonyManager.getDeviceId()
- All GSM devices (all tested with a SIM) returned a value for TelephonyManager.getSimSerialNumber()
- All CDMA devices returned null for getSimSerialNumber() (as expected)
- All devices with a Google account added returned a value for ANDROID_ID
- All CDMA devices returned the same value (or derivation of the same value) for both ANDROID_ID and TelephonyManager.getDeviceId() — as long as a Google account has been added during setup.
So if you want something unique to the device itself, TM.getDeviceId() should be sufficient. Obviously some users are more paranoid than others, so it might be useful to hash 1 or more of these identifiers, so that the string is still virtually unique to the device, but does not explicitly identify the user’s actual device. For example, using String.hashCode(), combined with a UUID:
Read the TelephonyManager properties, so add this to your manifest: