Where And When Is Generated Android.build.serial In Aosp?
Solution 1:
According to this thread, it clearly says that it's unique, but added since API 9 and may be not present on all devices.
If you're writing your app for a specific device's model, you could direclty check if it has an IMEI. Otherwise, as you said, I recommend you to write a custom ID generator module. You will be sure that your ID will be unique and available for all devices.
IMEI represents the serial number of the device. It's sure it's unique. Two different devices can't have the same serial number.
To get the serial number of the device you just have to call :
Stringserial= Build.SERIAL;
It exists another approach. You can get the id by calling Secure.ANDROID_ID
.
A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device. (The value may change if a factory reset is performed on the device.)
privatefinalStringANDROID_ID= Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
Take care because it says that the value MAY change if a factory reset is performed.
Post a Comment for "Where And When Is Generated Android.build.serial In Aosp?"