获取Android 唯一标识

来源:互联网 发布:npc算法 编辑:程序博客网 时间:2024/05/20 18:49

1.使用ANDROID_ID

import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(),
                                                       
Secure.ANDROID_ID);
这个值应该是在系统第一次启动后计算出来的,设备恢复出厂设置之后,再次启动这个值可能会改变。
2.2版本的会有问题。

2.使用wifi网卡mac地址
WifiManager wm = (WifiManager)Ctxt.getSystemService(Context.WIFI_SERVICE);
wm.getConnectionInfo().getMacAddress();

3.Device ID
String deviceId = ((TelephonyManager) context.getSystemService( Context.TELEPHONY_SERVICE )).getDeviceId();


原创粉丝点击