How can I get the UUID of my Android phone in an application?

后端 未结 7 2151
野趣味
野趣味 2020-11-27 10:58

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.

Here is th

相关标签:
7条回答
  • 2020-11-27 11:38

    This works for me:

    TelephonyManager tManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    String uuid = tManager.getDeviceId();
    

    EDIT :

    You also need android.permission.READ_PHONE_STATE set in your Manifest. Since Android M, you need to ask this permission at runtime.

    See this anwser : https://stackoverflow.com/a/38782876/1339179

    0 讨论(0)
提交回复
热议问题