问题
I require the list of fixed properties of android.os.Build
class. I've obtained the list from here I bold those that I know are fixed. By fix I mean no change by firmware update, reset factory, ...
android.os.Build.VERSION.RELEASE //The current development codename, or the string "REL" if this is a release build.
android.os.Build.BOARD //The name of the underlying board, like "goldfish".
android.os.Build.BOOTLOADER // The system bootloader version number.
android.os.Build.BRAND //The brand (e.g., carrier) the software is customized for, if any.
android.os.Build.CPU_ABI //The name of the instruction set (CPU type + ABI convention) of native code.
android.os.Build.CPU_ABI2 // The name of the second instruction set (CPU type + ABI convention) of native code.
android.os.Build.DEVICE // The name of the industrial design.
android.os.Build.DISPLAY //A build ID string meant for displaying to the user
android.os.Build.FINGERPRINT //A string that uniquely identifies this build.
android.os.Build.HARDWARE //The name of the hardware (from the kernel command line or /proc).
android.os.Build.HOST
android.os.Build.ID //Either a changelist number, or a label like "M4-rc20".
android.os.Build.MANUFACTURER //The manufacturer of the product/hardware.
android.os.Build.MODEL //The end-user-visible name for the end product.
android.os.Build.PRODUCT //The name of the overall product.
android.os.Build.TAGS //Comma-separated tags describing the build, like "unsigned,debug".
android.os.Build.TYPE //The type of build, like "user" or "eng".
android.os.Build.USER
Please help me complete the list
回答1:
If you look at the source code to Build, you will see that all of these values -- including those you have in bold -- come from system properties files. Hence, any of these values can be modified by ROM modders or the original device manufacturer as they see fit.
回答2:
I'm not going to address the woes with consistencies of Build
as Mark has illustrated why there isn't a guaranteed answer. Instead I want to respond to what your purpose and intent is.
If I understand correctly, you are trying to uniquely identify a single device. I point you firstly to this answer, from which you can simply conclude that a generic solution is not possible. Either resetting factory defaults or switching SIM cards (if the device has one) will change any sort of unique ID and fool your app into thinking it's a different user.
You need to rethink what you're trying to accomplish. Why do you need to uniquely identify a device? If you're trying to identify a user, then this mindset doesn't cope for multiple devices either. This is now especially the case with Jellybean 4.2, where a device may support multiple users. See also this insightful blog post on the Android Developers Blog.
Can you have the user attach his Google account? Or account for your own service? If you can identify a user, it is then trivial to identify individual devices through UUID.randomUUID()
.
回答3:
If I understand correctly (regarding your follow-up comment) you want to identify a device without integrating some kind of registration or login mechanism.
Instead of implementing yout own ID computation algorithm I would suggest using an OpenUDID implementation for android (see https://github.com/vieux/OpenUDID).
来源:https://stackoverflow.com/questions/13267429/which-properties-of-android-os-build-are-fixed