【问题标题】:How to get Device Serial Number (Not Device ID)如何获取设备序列号(不是设备 ID)
【发布时间】:2014-03-06 20:53:57
【问题描述】:

如何获取设备序列号?我不想要设备 ID。我想要序列号(我们在 Eclipse 的设备视图中看到的那个)。如果没有办法得到,我至少可以知道它存储在哪里吗?

【问题讨论】:

    标签: android serial-number


    【解决方案1】:

    只要你使用 API 9

    Build.SERIAL
    

    应该返回与 Eclipse 显示的相同的值。

    【讨论】:

    • 这与设备上通常打印的序列号是否相同?
    【解决方案2】:
    You can use the getprop command on the adb shell and check yourself that which of the files contains the correct Serial number.Many times the serial number is located on different files and code has to be device specific.
    
    Foe samung Tab 3 you can use the following code:
    
    filename=sys.serial//for samsung tab 3
    filename=ro.serial//for samsung t211 tab
    filename=ril.serial//for samsung 10inch note
    try {
    
            Class<?> c = Class.forName("android.os.SystemProperties");
    
            Method get = c.getMethod("get", String.class, String.class);
    
            serialnum = (String) (get.invoke(c, filename, "unknown"));
    
        } catch (Exception ignored) {
    
            serialnum = "unknown";
    
        }
    

    【讨论】:

      猜你喜欢
      • 2013-02-09
      • 1970-01-01
      • 2023-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多