What is the difference between android ID and device ID?

Here's how I obtain them:

Android ID:

String androidID = Settings.Secure.getString(MainActivity.this.getContentResolver(),

Device ID:

String deviceID = ((TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE))

I need to uniquely identify my android device. Using deviceID needs the permission to "make and manage phone calls". While using androidID doesn't. Therefore, I'm going with androidID as I don't need any call-management privileges.

  1. What is the exact difference between the two? If there's none, why are there two IDs?

  2. Will both the ids reset if I factory reset my device?

  3. I know deviceID works for all versions of android. Will androidID work for all versions?

1 Answer 1


While your question targets a development issue (which is off-topic here), the answer is relevant for users as well, so I'm going to answer it:

  • 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
  • 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 ), 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).

To my knowledge, all those IDs are available across all Android versions (at least across those which are currently relevant, i.e. GB/2.3 and up). The last two obviously only if GApps are installed – so on devices running a Custom ROM without GApps, they might not exist.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .