2012-10-08 118 views

回答

1

只要您使用API​​ 9

Build.SERIAL 

應返回相同的值作爲Eclipse的節目。

+0

這是與通常在設備上打印的序列號相同的序列號嗎? – guidod

0
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"; 

    }