Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Android Device Identifier From ADB and Android SDK

Tags:

android

adb

I am looking for the easiest way to get a unique android device identifier from both the Android adb and the Android ADK itself.

For example, when i use the adb 'devices' command, the serial number of my connected device is outputted to the screen. I have yet to identify a method in the Android sdk to get me the same serial number.

I don't care what unique identifier is used, just something that can be easily retrieved from both the adb and android sdk. Rooting a device will not be an option.

like image 629
user163757 Avatar asked Mar 30 '11 13:03

user163757


People also ask

How can I get Android device ID?

There are several ways to know your Android Device ID 2- Another way to find the ID is by going to the Menu >Settings > About Phone > Status. The IMEI / IMSI / MEID should be present in the phone status setting. 3- The ID could also be below or under the battery or on the back or bottom of the device itself.

How can I get IMEI number from adb?

adb shell dumpsys iphonesybinfo You can check and save the IMEI number of your device by dialing *#06# in your dialer app and taking a screenshot of it.

How do I find my device identifier?

How to find your device ID. Finding your device ID is straightforward whether you have an Android or an Apple device. For an Android enter “*#*#8255#*#*” into the keypad. As soon as you type the last digit the GTalk service monitor device will pop up where you will be able to see your device ID.


3 Answers

You would probably want to use ANDROID_ID.

This is how you can query its value via adb shell:

settings get secure android_id

Or by querying the settings content provider:

content query --uri content://settings/secure/android_id --projection value
like image 103
Alex P. Avatar answered Oct 04 '22 10:10

Alex P.


Android stores all the device related info in one or the other sqlite DB. These databases can be found in /data/data/ folder. To read these databases from adb you will need root permissions.

The android id is available in /data/data/com.android.providers.settings/databases/settings.db

So for adb use this command.

adb shell sqlite3 /data/data/com.android.providers.settings/databases/settings.db "select value from secure where name = 'android_id'"

**you must be running adb as root in adb

like image 24
BabbarTushar Avatar answered Oct 04 '22 09:10

BabbarTushar


Simple as that with adb

adb devices -l
like image 14
Hadnazzar Avatar answered Oct 04 '22 10:10

Hadnazzar