You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This problem is largely a consequence of a setting shown in the question:
beaconManager.backgroundBetweenScanPeriod = 0
It probably also only happens if you set beaconManager.eneableScheduledScanJobs =false because otherwise scanning would be auto restarted every 15-25 mins.
The reason is that when the background between scan period is 0, scanning never stops and also never restarts. If you turn off Bluetooth and turn it back on, that effectively kills the original scan. And because the library was told to never stop that original scan, it never detects again.
Clearly, this is not intended library behavioral — it is a bug. The library should register for Bluetooth off/ on events and restart scanning in the on event.
Until this is fixed, you can work around this by doing one of two things:
Set the between scan period to something small like 100 ms.
Register for callbacks on Bluetooth state n your app, and if it goes off, stop ranging, and if it starts again, restart ranging.
Expected behavior
Ranging should return beacons after phone's bluetooth is turned off and back on
Actual behavior
Scanner keeps running but beacons are not reported
Steps to reproduce this behavior
Mobile device model and OS version
Moto G Power 2021 Android 11
Android Beacon Library version
2.19.2
I opened a question in stackoerflow with more details on my config
https://stackoverflow.com/questions/72552856/altbecon-ranging-stops-detecting-beacons-after-phones-bluetooth-is-turned-off-a
Thanks
The text was updated successfully, but these errors were encountered: