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
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:
adb devices
And the output will look something like this:
List of devices attached
YOGAA1BBB412 device
From the previous output, you will need the device ID number (eg: YOGAA1BBB412
). To get the Device ID, I use the following adb command:
adb -s YOGAA1BBB412 shell getprop | grep product.model
And the output looks like this:
[ro.product.model]: [Lenovo YT3-X90F]
Use getprop net.hostname
which has an Android unique Id followed by keyword android-<64 bit Hexadecimal String>
example:
[net.hostname]: [android-a487e0560d669e4a]
To find everything about connected usb device on ubuntu use below command
lsusb -v
See the link
it will give u device id like
Bus 001 Device 005: ID 18d1:4ee7 Google Inc.
So use first four "18d1" to add android usb rules
The Android serial number can be retreived within the device with getprop :
getprop ro.serialno
From Java, you may want to execute it with Runtime.exec()
you should probably use IMEI:
TelephonyManager m = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
String imei = m != null ? m.getDeviceId() : null;