试图获得与Android手机的蓝牙
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
String bleMAC = bluetoothAdapter.getAddress();
该函数的结果是02:00:00:00:00:00,我期望00:04:61:02:AA:FF的某些行
还注意到wifi mac地址与Bluetooth mac地址相同。可以使用wifi MAC地址吗?
根据Android 6.0的更改:
为了从版本开始,Android为用户提供更好的数据保护,对于使用Wi-Fi和Bluetooth API的应用,Android删除对设备本地硬件标识符的编程访问。WifiInfo.getMacAddress()和BluetoothAdapter.getAddress()方法现在返回常量值02:00:00:00:00:00。
要通过蓝牙和Wi-Fi扫描访问附近的外部设备的硬件标识符,您的应用现在必须具有ACCESS_FINE_LOCATION或ACCESS_COARSE_LOCATION权限。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句