how to decode android.os.Build.SERIAL?

前端 未结 4 2015
攒了一身酷
攒了一身酷 2020-12-11 07:28

I\'m working on the recurring serial number topic to provide a unique id.

I try this :

       String serial = null; 

        try {
            Clas         


        
相关标签:
4条回答
  • 2020-12-11 07:57

    Have you tried this?

    String serial = null; 
    
    try {
         Class<?> c = Class.forName("android.os.SystemProperties");
         Method get = c.getMethod("get", String.class);
         serial = (String) get.invoke(c, "ril.serialnumber");
     } catch (Exception ignored) {
     }
    
    0 讨论(0)
  • 2020-12-11 08:05

    If you want to get the serial number as shown on the back of the device and if you are using the Samsung Galaxy Tab then why not use the 'ril.serialnumber' property

    Items changed to what your device should show:

    $ adb shell getprop | grep serial
    [ril.serialnumber]: [RF2C202WYME]
    [ro.boot.serialno]: [c4f12fdd949f22f]
    [ro.serialno]: [c4f12fdd949f22f]
    

    Pre-jellybean 'ro.boot.serialno' didn't exist

    0 讨论(0)
  • 2020-12-11 08:10

    On many devices there is information displayed in the Settings --> About activity that is non-standard and is not available from any standard Android API. For example, the FCC ID is sometimes displayed there but is not available to apps.

    Also, there is no requirement that the serial number available through the API's be the product's 'real' serial number (i.e. the one on the package). Just that it be unique.

    So, I think there is no way to do what you want (read the serial number that is on the box and in the about activity) other then look through that product's source code (if available) and see if there is a way to get that info for that particular product or manufacturer.

    0 讨论(0)
  • 2020-12-11 08:10

    you should use sys.serialnumber ,some devices have ril.serialnumber and some have sys.serialnumber ,so you should try sys one

    0 讨论(0)
提交回复
热议问题