我如何通过编程方式获取Android设备的Mac ID.我已经完成了IMIE Code,我知道如何手动检查设备上的Mac ID,但不知道如何以编程方式查找.
解决方法:
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);WifiInfo wInfo = wifiManager.getConnectionInfo();String macAddress = wInfo.getMacAddress();
此外,在清单文件中添加以下权限
<uses-permission androID:name="androID.permission.ACCESS_WIFI_STATE"/>
请参考Android 6.0 Changes.
总结To provIDe users with greater data protection, starting in this release, AndroID removes programmatic access to the device’s local harDWare IDentifIEr for apps using the Wi-Fi and Bluetooth APIs. The WifiInfo.getMacAddress() and the BluetoothAdapter.getAddress() methods Now return a constant value of 02:00:00:00:00:00.
To access the harDWare IDentifIErs of nearby external devices via Bluetooth and Wi-Fi scans, your app must Now have the ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permissions.
以上是内存溢出为你收集整理的如何以编程方式查找Android设备的MAC地址全部内容,希望文章能够帮你解决如何以编程方式查找Android设备的MAC地址所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)