Requesting multiple Bluetooth permissions in Android Marshmallow

前端 未结 1 1303
离开以前
离开以前 2021-01-13 01:41

I\'m developing an app with connectivity which connects to a Bluetooth device with SDK 23 as compile with. I\'m having problems with requesting multiple permissions for Blue

1条回答
  •  天涯浪人
    2021-01-13 02:12

    BLUETOOTH and BLUETOOTH_ADMIN are normal permissions and are therefore they are automatically granted. Only permissions in the table of dangerous permissions need to requested at runtime.

    However, as mentioned in the Android 6.0 changes: Access to Hardware Identifier:

    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:

    • WifiManager.getScanResults()
    • BluetoothDevice.ACTION_FOUND
    • BluetoothLeScanner.startScan()

    If you're using any of those methods, you'll need to request at least ACCESS_COARSE_LOCATION at runtime (as it is a dangerous permission).

    0 讨论(0)
提交回复
热议问题