Hardware identifier
Android 6.0 has introduced a major change for greater data protection; the WifiInfo.getMacAddress()
and BluetoothAdapter.getAddress()
methods now return a constant value of 02:00:00:00:00:00
, which means you can't rely on these methods to get information.
Now, when you're trying to use some of the methods in the API, you need to add permissions:
WifiManager.getScanResults()
andBluetoothLeScanner.startScan()
need one of these two permissions granted:The
ACCESS_FINE_LOCATION
permissionThe
ACCESS_COARSE_LOCATION
permission
BluetoothDevice.ACTION_FOUND
: This must have theACCESS_COARSE_LOCATION
permission
Note
When a device running Android 6.0 (Marshmallow) initiates a background Wi-Fi or Bluetooth scan, external devices see the origin as a randomized MAC address.