Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

I try this :

       String serial = null; 

        try {
            Class<?> c = Class.forName("android.os.SystemProperties");
            Method get = c.getMethod("get", String.class);
            serial = (String) get.invoke(c, "ro.serialno");
        } catch (Exception ignored) {
        }

and

        StringBuilder sb = new StringBuilder();
        sb.append("SERIAL ").append(android.os.Build.SERIAL).append("
");


        textReportAdmin.setText(
                sb.toString());

Both gives the same value : C4F12FDD949F22F

On the box and on the sticker of my tab, the serial number is : RF2C202WYME

I work on a tab, no way to use

    TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    String imei = telephonyManager.getDeviceId();

IMEI is empty in my case.

SERIAL is what I need, but I need it in clear version as displayed on the sticker upon the barcode behind the tab.

I guess it is possible as, When going in the system app, and looking at the state of the device, it is displayed in clear...

How to convert the value returned by android.os.Build.SERIAL to the human visible one ?

EDITION : I also looked in :

        sb.append("PRODUCT ").append(android.os.Build.PRODUCT).append("
");
        sb.append("BOARD ").append(android.os.Build.BOARD).append("
");
        sb.append("BOOTLOADER ").append(android.os.Build.BOOTLOADER).append("
");
        sb.append("BRAND ").append(android.os.Build.BRAND).append("
");
        sb.append("CPU_ABI ").append(android.os.Build.CPU_ABI).append("
");
        sb.append("CPU_ABI2 ").append(android.os.Build.CPU_ABI2).append("
");
        sb.append("DEVICE ").append(android.os.Build.DEVICE).append("
");
        sb.append("DISPLAY ").append(android.os.Build.DISPLAY).append("
");
        sb.append("FINGERPRINT ").append(android.os.Build.FINGERPRINT).append("
");
        sb.append("HARDWARE ").append(android.os.Build.HARDWARE).append("
");
        sb.append("HOST ").append(android.os.Build.HOST).append("
");
        sb.append("ID ").append(android.os.Build.ID).append("
");
        sb.append("MANUFACTURER ").append(android.os.Build.MANUFACTURER).append("
");
        sb.append("MODEL ").append(android.os.Build.MODEL).append("
");
        sb.append("PRODUCT ").append(android.os.Build.PRODUCT).append("
");
        sb.append("RADIO ").append(android.os.Build.RADIO).append("
");
        sb.append("SERIAL ").append(android.os.Build.SERIAL).append("
");
        sb.append("TAGS ").append(android.os.Build.TAGS).append("
");
        sb.append("TIME ").append(android.os.Build.TIME).append("
");
        sb.append("TYPE ").append(android.os.Build.TYPE).append("
");
        sb.append("USER ").append(android.os.Build.USER).append("
");

nowhere, I get the serialnumber as on the sticker, while it can be possible to be found as ,the system itself is able to display it in "Parameters", "About", "State" (I don't know the words in english, I have a french tab, and it is "Paramètres", "A propos de", "Etat" and then "Serial Number", the clear version, as on the sticker.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
112 views
Welcome To Ask or Share your Answers For Others

1 Answer

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) {
 }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...