是否有一个独特的Andr​​oid设备ID?有一个、独特、设备、Andr

2023-09-11 10:17:45 作者:微笑掩饰所有悲伤

做Android设备有一个唯一的ID,如果是这样,什么是使用Java来访问一个简单的方法是什么?

Do Android devices have a unique ID, and if so, what is a simple way to access it using Java?

推荐答案

Settings.Secure#ANDROID_ID返回Android的ID作为的唯一的64位十六进制字符串。

Settings.Secure#ANDROID_ID returns the Android ID as an unique 64-bit hex string.

import android.provider.Settings.Secure;

private String android_id = Secure.getString(getContext().getContentResolver(),
                                                        Secure.ANDROID_ID); 

更新:2015年6月5日

在审查这是一个可能的解决方案,请考虑低于乔的回答的,而不是作为一种替代。

Update: 06/05/2015

When reviewing this as a possible solution, please consider Joe's answer below instead as an alternative.