Location needs to be enabled for Bluetooth Low Energy Scanning on Android 6.0

前端 未结 8 680
旧巷少年郎
旧巷少年郎 2020-11-27 13:05

After upgrading to Android version 6.0 Bluetooth Low Energy (BLE) scanning will only work if Location services are enabled on the device. See here for reference: Bluetooth L

8条回答
  •  独厮守ぢ
    2020-11-27 13:37

    You can use BluetoothAdapter.startDiscovery().
    It will scan for both Bluetooth Smart and classic Bluetooth devices, but location services do not need to be enabled.
    (You still need ACCESS_COARSE_LOCATION permissions on Android 6.)

    You can call BluetoothDevice.getType on found devices to filter for Bluetooth Smart / Low Energy devices.

提交回复
热议问题