4

我需要类的固定属性列表android.os.Build。我从这里获得了列表,我将那些我知道已修复的列表加粗。通过修复,我的意思是固件更新,重置工厂,......

  1. android.os.Build.VERSION.RELEASE //当前开发代号,如果这是发布版本,则为字符串“REL”。

  2. android.os.Build.BOARD //底层板的名称,如“goldfish”。

  3. android.os.Build.BOOTLOADER // 系统引导加载程序版本号。

  4. android.os.Build.BRAND //软件定制的品牌(例如运营商),如果有的话。

  5. android.os.Build.CPU_ABI //native code的指令集名称(CPU类型+ABI约定)。

  6. android.os.Build.CPU_ABI2 //原生代码的第二个指令集(CPU类型+ABI约定)的名称。

  7. android.os.Build.DEVICE // 工业设计的名称。

  8. android.os.Build.DISPLAY //用于向用户显示的构建 ID 字符串

  9. android.os.Build.FINGERPRINT //唯一标识此构建的字符串。

  10. android.os.Build.HARDWARE //硬件的名称(来自内核命令行或/proc)。

  11. android.os.Build.HOST

  12. android.os.Build.ID //可以是变更列表编号,也可以是“M4-rc20”之类的标签。

  13. android.os.Build.MANUFACTURER //The manufacturer of the product/hardware.

  14. android.os.Build.MODEL //The end-user-visible name for the end product.

  15. android.os.Build.PRODUCT //The name of the overall product.

  16. android.os.Build.TAGS //Comma-separated tags describing the build, like "unsigned,debug".

  17. android.os.Build.TYPE //The type of build, like "user" or "eng".

  18. android.os.Build.USER

Please help me complete the list

4

3 回答 3

16

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.

于 2012-11-14T12:07:46.623 回答
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().

于 2012-11-15T10:56:13.740 回答
1

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).

于 2012-11-18T10:07:19.557 回答