如何以编程方式查找Android设备的MAC地址

如何以编程方式查找Android设备的MAC地址,第1张

概述我如何通过编程方式获取Android设备的MacId.我已经完成了IMIECode,我知道如何手动检查设备上的MacID,但不知道如何以编程方式查找.解决方法:WifiManagerwifiManager=(WifiManager)getApplicationContext().getSystemService(Context.WIFI_SERVICE);WifiInfowInfo=wifiM

我如何通过编程方式获取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地址所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1103890.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存