Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that you can find IMEI and MAC address and others by going to Settings -> About phone -> Status. You can also find IMEI by typing *#06# on the keypad. Is there any way to get the ANDROID_ID on the phone itself, as opposed to via this bit of code?

Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID);
share|improve this question
up vote 2 down vote accepted

There is no where in the stock system that provides the ID, however there are apps that will provide it, such as Android System Info.

Some stock ROMS hidden menus also contain this info.

share|improve this answer

You can do this via adb. Does not require root, as far as I know (tested on a Galaxy Nexus running 4.2.1 built from AOSP source):

shell@android:/ $ content query --uri content://settings/secure --projection value --where "name='android_id'"
  settings/secure --projection value --where "name='android_id'"                
  Row: 0 value=<your ID in hexadecimal>
shell@android:/ $
share|improve this answer
If running via a terminal emulator app, root is required. – Liam W Dec 18 '12 at 15:34
adb has more privileges than the local shell user. With Android 4.x (ICS and up), you can even do a full backup via ADB on an unrooted device -- which the shell user for sure cannot. – Izzy Dec 18 '12 at 17:47

settings get secure android_id from adb shell is the simplest, I find — no extraneous output and does not require root. (From a regular terminal on the device, root is required.)

shell@mydevice:/ $ settings get secure android_id
shell@mydevice:/ $ 
share|improve this answer
@Firelord Looks like another case of adb's additional permissions coming into play, I have corrected the answer. Thanks for catching that. – Matthew Read May 20 '15 at 15:26

As eldarerathis variant didn't work out for me, and I didn't want to install an app just for that, I've found a different way. Only possible drawback: It requires root.

adb shell
$ su
# cd /data/data/
# sqlite3 settings.db
sql> select * from secure where name='android_id';

The android_id is found in the third column here (anonymized in the example).


Note that this is NOT the android_id used by the Google apps. Google seems to have decided for some confusion here. For Play Services, there's a separate android_id stored by GTalk, as pointed out by a blog post (also see this answer by HassleFixes, who is the autor of StripSearch, and thankfully pointed this out in the comments):

  • call up your dialer
  • dial *#*#8255#*#*
  • watch out for "Device ID"
  • remove the leading android-
  • what remains, is the android_id used by Google Services

I've verified that: the android_id retrieved this way works fine on a device with no Google-Apps installed (used with the BlankStore provided by the NOGAPPS project).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.