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.
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.
**you must be running adb as root in adb
Please make sure your device is connected by running the below command.
after that to get the android id of that device you can run the below command.
Try ANDROID_ID. As documentation says "[it] is randomly generated on first boot and should remain constant for the lifetime of the device".
I use adb. First I list the attached device ID numbers with the following command:
And the output will look something like this:
From the previous output, you will need the device ID number (eg:
YOGAA1BBB412
). To get the Device ID, I use the following adb command:And the output looks like this: