Pergunta

Does the sample code from the official documentation work for anyone? After doing startLeScan, the onLeScan callback never gets called (Nexus 4, Android 4.3).

Meanwhile, another app that I have installed (BLE Heart Rate) doesn't seem to have any issues finding nearby Bluetooth LE devices (Fitbit One, Polar H7), so I must be missing something?

Foi útil?

Solução

I forgot to add the BLUETOOTH_ADMIN permission. Without this permission, one can still call startLeScan,it just won't ever discover any devices!

<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

Outras dicas

For me it works. Not very well though. (after some tests it will start disconnecting and I need to toggle the bluetooth on <--> off).

Have you missed something? What kind of device you are trying to find?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top