문제

How to get Device Serial Number? I don't want Device ID. I want Serial number (the one which we see in Devices view in Eclipse). If there is no way to get it, can I at least know where is it stored?

도움이 되었습니까?

해결책

As long as you are using API 9

Build.SERIAL

Should return the same value as Eclipse shows.

다른 팁

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

    }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top