startLeScan replacement to current api

前端 未结 5 559
北海茫月
北海茫月 2020-12-14 01:18

Goal is to read the values of a bluetooth LE heart rate monitor.

Using google\'s sample, I get

private void scanLeDevice(final boolean enable) {
             


        
5条回答
  •  伪装坚强ぢ
    2020-12-14 02:10

    Both methodsBluetoothAdapter.startLeScan and BluetoothAdapter.stopLeScan were deprecated in Android Lollipop. As a replacement BluetoothLeScanner were introduced and acting as a scan controller.

    If you develop BLE-based application you should control either scan via the BluetoothAdapter (Android 4.3 and Android 4.4) or the BluetoothLeScanner. The API introduced in Android Lollipop offers much greater features in terms of battery power consumption.

提交回复
热议问题