2

デバイスのシリアル番号を取得するにはどうすればよいですか?デバイスIDは必要ありません。シリアル番号(Eclipseのデバイスビューに表示されるもの)が必要です。それを入手する方法がない場合、少なくともそれがどこに保存されているかを知ることができますか?

4

2 に答える 2

1

API9を使用している限り

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 に答える