如何获取设备序列号?我不想要设备 ID。我想要序列号(我们在 Eclipse 的设备视图中看到的那个)。如果没有办法得到它,我至少可以知道它存储在哪里?
问问题
2251 次
2 回答
1
只要您使用 API 9
Build.SERIAL
应该返回与 Eclipse 显示的相同的值。
于 2012-10-08T14:41:36.540 回答
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";
}
于 2014-03-06T12:53:57.990 回答