We have an app that scans for BlueTooth devices, searching for devices using iBeacon Protocol, but we have a problem with BleManager2:
when phone go in DOZE mode (Screen in black or pushing power button) scan of devices stops and restarts when phone reactivates.
When the app is active or in background, BLE scan runs correctly, we have problem only in DOZE mode.
In this state the service continues running but no BLE Beacon device is founded and the sub 'Manager_DeviceFound', in which we catch data from BT Beacon, is never invoked.
It seems that BLE Scan stops or become incapable to retrieve BT Beacon devices when in DOZE mode.
We have tried “MyLocation” example by Erel, inserting in "Tracker" service module the BleManager2 (public object in Process_Globals)
and the calling "scan2" function in sub "ScanTrack" after checking permission for ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION,
but we have the same problem: in doze mode gps is giving data, BLE scan stops.
We have added to manifest:
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.ACCESS_COARSE_LOCATION)
AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)
android:targetSdkVersion="29"
We have B4A 9.50, and we use a Samsung Galaxy A20e with android 10 for testing (Adaptive Battery disabled) .
On an old Tablet (Samsung SM-T561 with android 4.4.4) BT is functioning correctly even in DOZE mode.
Are there some permissions or settings that we have to set for android 10? Does BleManager2 need to be updated? Something we are missing in B4A?
Tips?
Thanks in advance