android_id和deviceId

来源:互联网 发布:eve美女捏脸数据 编辑:程序博客网 时间:2024/05/21 07:21
有些apk为了区分唯一设备,需要用到一个device id。
1. 取得设备的MAC address
   如果用户没有通过wifi连网路的话,就无法取得。
2. 使用TelephonyManager的getDeviceId()
3. 另外还有一个android系统的唯一区分ANDROID_ID,
   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);
原创粉丝点击