由网友(清风归客)分享简介:我寻求帮助,以获得我的Android手机的UUID。我已经搜查了网,发现一个潜在的解决方案,但它不工作的模拟器。I'm looking for help to get the UUID of my Android phone. I have searched the net and found one poten...
我寻求帮助,以获得我的Android手机的UUID。我已经搜查了网,发现一个潜在的解决方案,但它不工作的模拟器。
I'm looking for help to get the UUID of my Android phone. I have searched the net and found one potential solution but it is not working in the emulator.
下面是code:
Class<?> c;
try {
c = Class.forName("android.os.SystemProperties");
Method get = c.getMethod("get", String.class);
serial = (String) get.invoke(c, "ro.serialno");
Log.d("ANDROID UUID",serial);
} catch (Exception e) {
e.printStackTrace();
}
有谁知道为什么它不工作,或者有更好的解决办法?
Does anybody know why it isn't working, or have a better solution?
推荐答案
这对我的作品:
TelephonyManager tManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String uuid = tManager.getDeviceId();
相关推荐
最新文章