Since it's known that scanning beacons shouldn't require an internet connection, we were expecting Android Beacon Library by AltBeacon to detect beacons the same when the device is with or without an internet connection. Unfortunately, this is not the case in Android 11.
We've recently implemented the Android Beacon Library in our app and noticed a significant latency on Android 11 when the device is not connected to the internet (tested on Xiaomi 11). In contrast, on an Android 12 device the beacon detection works fast with or without an internet connection (tested on Xiaomi 12).
The latency seems to be caused by the call of the rangingObserver declared in:
beaconManager.getRegionViewModel(region).rangedBeacons.observe(this, rangingObserver)
It might be worth mentioning that we've also noticed a similar issue in the Beacon Scanner App which also implemented with the Android Beacon Library. Again, without an internet connection, the scanner has a significant latency in rendering the scanning list on an Android 11 device.
Has anyone encountered this issue or has any idea how this can be solved?
Please advise.
See a screenshot of Beacon Scanner App with and without Internet
Replication guidelines:
Use an Android 11 device.
Download the Beacon Scanner App.
Turn off any internet connection on your device (including Mobile Data and Wi-Fi).
Put several beacons in the region.
Launch the Beacon Scanner app and start scanning (important: make sure to kill the app if it was open before).
You should notice that the app is scanning but presents empty results for about a minute or more.
Try to launch the app with an active internet connection (via Mobile Data or Wi-Fi) and you will notice the detection happens instantly.