Android平板获取设备唯一ID的方式有很多,但每种貌似都有其缺点,根据stackoverflow上的评论,最终还是选择ANDROID_ID作为其唯一ID使用,已达到项目需求。
stackoverflow连接如下所示:
Is there a unique Android device ID?
import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(),Secure.ANDROID_ID);
或者:
String androidId = Settings.Secure.getString(MainActivity.this.getContentResolver(), Settings.Secure.ANDROID_ID);