Open ecitulsky-ims opened 2 months ago
Hello,
Whether your app can scan in the background depends on the filter. It has to be set and can't be empty. Otherwise, the scanning can be downgraded to opportunistic, meaning that you'll get a result if some other app is actively scanning.
The Nordic Scanner library
I'm not sure which library are you referring. This one? The scanner API allows to set a filter here: https://github.com/NordicSemiconductor/Kotlin-BLE-Library/blob/a3ce8abcb173e28c4e5aaf55399afa621288d140/scanner/src/main/java/no/nordicsemi/android/kotlin/ble/scanner/BleScanner.kt#L91-L94
[!Note] I'm working on a new version of this library (Kotlin BLE Library). An early alpha version is available on version/2.0 branch, but API is far from stable.
When the app is in the background, and a beacon comes into range, app does not receive notification that beacon is present. The beacon can be around for quite a bit of time with no detection.
If I open up the system settings and navigate to BT menu, I can see the beacon. As soon as this happens, the app receives the notification the beacon is present. The Nordic Scanner library does not seem to be performing scans in the background at all.
NOTE: We have tested this on quite a few devices. It is most prevalent on Samsung but does occasionally occur on Pixel phones as well.