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 \'devi
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
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
Simple as that with adb
adb devices -l
adb shell settings get secure android_id
This command returns ANDROID_ID but it may not be the same as ANDROID_ID received at code level. The application can use different min API level and the value obtained from adb shell may not match
It was possible to get the ANDROID_ID from [net.hostname] prop. It worked in API level 23.
Command to get the android_id for API level 23
adb shell getprop net.hostname
In android 8.0 and above this prop returns null due to android privacy policy changes. Hence, ANDROID_ID doesn't remain to be a reliable method of unique device id comparison.
Please make sure your device is connected by running the below command.
adb devices -l
after that to get the android id of that device you can run the below command.
adb shell content query --uri content://settings/secure --where "name=\'android_id\'"
Try this and find the id
besides Android. The command gives basically all info about the phone.
adb -s <YOUR-DEVICE-ID> shell getprop