0

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?

ejain
  • 3,456
  • 2
  • 34
  • 52

2 Answers2

3

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"/>
ejain
  • 3,456
  • 2
  • 34
  • 52
  • I just found out the same thing today... I would have expected some error when trying startLeScan without permission. – philfr Aug 09 '13 at 09:59
0

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?

  • 1
    Here's the code I am using: https://gist.github.com/ejain/19625986155bf76b85da. I have several BLE devices nearby, and none of them get listed. The other app I mentioned doesn't have any trouble listing the devices and connecting--though there is an issue that once you disconnect, you can no longer reconnect... – ejain Aug 01 '13 at 11:44
  • Sample also working for me. Nexus 4 with Viiiiva HRM doing HR profile is looking good. – Ifor Aug 03 '13 at 22:39