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);