Search code examples
androidbluetoothandroid-wifiandroid-bluetooth

Android bluetooth MAC obtained is 02:00:00:00:00:00


Trying to get the Bluetooth of an android phone with

BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
String bleMAC = bluetoothAdapter.getAddress();

the result of the function is 02:00:00:00:00:00, i am expecting some thing the lines of 00:04:61:02:AA:FF

Also noticed that wifi mac address are same as Bluetooth mac address. Can the wifi MAC address be used?


Solution

  • As Per Android 6.0 Changes:

    https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-hardware-id

    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.