1
votes

I'm using Radius Networks Open Source Android iBeacon Library, and for some reason at a times it just stops working, that is, it's working ok and then without any apparent reason it stops ranging or at least that's what it appears to be happening. I have experience the same behavior with their iBeacon Locate app.

When this problem occurs, closing and opening the app doesn't help. To get app work properly again I have to close the app, disable the bluetooth, open the app (so the app complains about the bluetooth being disabled), enable the bluetooth and then open the app again.

I have captured the LogCat when the app starts and works properly and when it doesn't, and I have noticed some differences between one and the other that might provide a clue of what's happening.

LogCat when starts and works properly:

07-07 19:51:54.519: D/IBeaconManager(1490): we have a connection to the service now
07-07 19:51:54.629: I/IBeaconService(1490): start ranging received
07-07 19:51:54.629: I/ActivityManager(592): Displayed com.core.vordrawer/.MainActivity: +654ms (total +999ms)
07-07 19:51:54.629: D/BluetoothAdapter(1490): startLeScan(): null
07-07 19:51:54.669: D/BtGatt.GattService(11998): registerClient() - UUID=2c657179-3c94-4f2f-9c0b-2035f646b8a4
07-07 19:51:54.669: D/BtGatt.btif(11998): btif_gattc_register_app
07-07 19:51:54.669: D/BtGatt.btif(11998): btgattc_handle_event: Event 1000
07-07 19:51:54.669: D/BtGatt.btif(11998): btif_gattc_upstreams_evt: Event 0
07-07 19:51:54.669: D/BtGatt.GattService(11998): onClientRegistered() - UUID=2c657179-3c94-4f2f-9c0b-2035f646b8a4, clientIf=5
07-07 19:51:54.669: D/BluetoothAdapter(1490): onClientRegistered() - status=0 clientIf=5
07-07 19:51:54.669: D/BtGatt.GattService(11998): startScan() - queue=0
07-07 19:51:54.669: D/BtGatt.GattService(11998): startScan() - adding client=5
07-07 19:51:54.669: D/BtGatt.btif(11998): btif_gattc_scan
07-07 19:51:54.669: D/BtGatt.btif(11998): btgattc_handle_event: Event 1002
07-07 19:51:54.689: I/bt-hci(11998): BLE HCI(id=62) event = 0x02)
07-07 19:51:54.689: I/bt-hci(11998): btu_ble_process_adv_pkt
07-07 19:51:54.689: I/bt-hci(11998): BLE HCI(id=62) event = 0x02)
07-07 19:51:54.689: I/bt-hci(11998): btu_ble_process_adv_pkt
07-07 19:51:54.699: I/bt-hci(11998): BLE HCI(id=62) event = 0x02)
07-07 19:51:54.699: I/bt-hci(11998): btu_ble_process_adv_pkt
07-07 19:51:54.699: D/BtGatt.btif(11998): btif_gattc_upstreams_evt: Event 4096
07-07 19:51:54.699: D/BtGatt.btif(11998): btif_gattc_add_remote_bdaddr device added idx=0
...

LogCat when starts and DOESN'T work properly:

07-07 19:58:48.270: D/IBeaconManager(4630): we have a connection to the service now
07-07 19:58:48.380: I/IBeaconService(4630): start ranging received
07-07 19:58:48.380: D/BluetoothAdapter(4630): startLeScan(): null
07-07 19:58:48.390: I/ActivityManager(592): Displayed com.core.vordrawer/.MainActivity: +644ms (total +846ms)
07-07 19:58:48.420: D/BtGatt.GattService(11998): registerClient() - UUID=33ecc2dc-ee8f-4bb1-b306-e5a2b82a1cba
07-07 19:58:48.420: D/BtGatt.btif(11998): btif_gattc_register_app
07-07 19:58:48.420: D/BtGatt.btif(11998): btgattc_handle_event: Event 1000
07-07 19:58:48.420: D/BtGatt.btif(11998): btif_gattc_upstreams_evt: Event 0
07-07 19:58:48.420: D/BtGatt.GattService(11998): onClientRegistered() - UUID=33ecc2dc-ee8f-4bb1-b306-e5a2b82a1cba, clientIf=7
07-07 19:58:48.420: D/BluetoothAdapter(4630): onClientRegistered() - status=0 clientIf=7
07-07 19:58:48.420: D/BtGatt.GattService(11998): startScan() - queue=0
07-07 19:58:48.420: D/BtGatt.GattService(11998): startScan() - adding client=7
07-07 19:58:48.420: D/BtGatt.btif(11998): btif_gattc_scan
07-07 19:58:48.420: D/BtGatt.btif(11998): btgattc_handle_event: Event 1002
07-07 19:58:48.420: I/IBeaconService(4630): Adjusted scanStopTime to be Mon Jul 07 19:58:49 GMT-04:30 2014
07-07 19:58:48.570: D/dalvikvm(20228): GC_EXPLICIT freed 2477K, 19% free 28473K/35068K, paused 2ms+7ms, total 41ms
07-07 19:58:48.831: D/dalvikvm(592): GC_EXPLICIT freed 523K, 22% free 26548K/33668K, paused 7ms+9ms, total 150ms
07-07 19:58:49.031: D/dalvikvm(21666): GC_EXPLICIT freed 257K, 7% free 9474K/10172K, paused 2ms+4ms, total 23ms
07-07 19:58:49.521: D/Callback(4630): attempting callback via intent: ComponentInfo{com.core.vordrawer/com.radiusnetworks.ibeacon.IBeaconIntentProcessor}
...

In this last LogCat I believe the usefull messages might be:

  • I/IBeaconService(4630): Adjusted scanStopTime to be Mon Jul 07 19:58:49 GMT-04:30 2014

  • D/Callback(4630): attempting callback via intent: ComponentInfo{com.core.vordrawer/com.radiusnetworks.ibeacon.IBeaconIntentProcessor}

But I don't know what to do with that...

Thanks in advance of any assistance you can give me.

1

1 Answers

0
votes

It looks like this is a low-level issue with your bluetooth hardware or driver. In the second log snippet you don't see any lines like:

07-07 19:51:54.699: I/bt-hci(11998): BLE HCI(id=62) event = 0x02)
07-07 19:51:54.689: I/bt-hci(11998): btu_ble_process_adv_pkt

These log lines indicate that your Android device is detecting a bluetooth advertising packet from your beacon. Based on your description, it sounds like your bluetooth hardware is getting in a bad state and shutting off bluetooth and turning it back on clears the condition.

A few things you can try to see what is causing this problem:

  1. Turn off wifi. On some Android phone models, wifi and bluetooth share an chip or antenna, and do not work well simultaneously.

  2. Shut off any other apps which may be interfering with bluetooth. The best way to do this is to reboot your phone and see if the app works without any other apps running. (You may also have to go into settings and uninstall any apps that are on auto startup that might use bluetooth.)

  3. Try on a different Android device if you have one available.