I want to develop an android app that is always listening ble advertisements, useful for beacons. The app has an activity and a background service. All BLE operations are done in service and this service executes a REST post when it finds a specific mac:
... mBluetoothAdapter.startLeScan(this); ...
public void onLeScan(final BluetoothDevice device, final int rssi, byte[] scanRecord) ...
If I run app and let smart phone apart, the screen turns off but app continues to work because I can see in REST service log that there was a call. However, more or less 3 hours later the android app stops call the rest service.
As the android service is Sticky, a stared again the app and close the app. 3 seconds later the service is started and I see rest calls beeing done. However, 15 minutes later the service stops calling rest server.
All logic is inside onLeScan() callback. So I can infer that this callback stops beeing called even though there are lots of BLE devices arround constantly advertising...
Please, any tips on this?
Thanks a lot