How to get Android application id?

后端 未结 13 645
失恋的感觉
失恋的感觉 2020-12-07 18:26

In Android, how do I get the application\'s id programatically (or by some other method), and how can I communicate with other applications using that id?

13条回答
  •  Happy的楠姐
    2020-12-07 18:47

    I am not sure what you need the app/installation ID for, but you can review the existing possibilities in a great article from Android developers:

    • http://android-developers.blogspot.com/2011/03/identifying-app-installations.html

    To sum up:

    • UUID.randomUUID() for creating id on the first time an app runs after installation and simple retrieval afterwards
    • TelephonyManager.getDeviceId() for actual device identifier
    • Settings.Secure.ANDROID_ID on relatively modern devices

提交回复
热议问题