Android平板獲取設備唯一ID

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章