-
Notifications
You must be signed in to change notification settings - Fork 837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Beacon scanning stops after 10 minutes when app is on foreground and enableForegroundServiceScanning is used. #1203
Comments
@davidgyoung I have pinpointed the reason for this issue, the DEFAULT_SCAN_TIMOUT_MILLIS was reduced from 30 minutes to 10 minutes in the Android OS with the following commit; So the variable in the CycledLeScanner class to restart scanning and enforce long scans below;
should be switched to 10 minutes. Also, as far as I understand, in order to enforce long scans we need to set the mLongScanForcingEnabled parameter of CycledLeScanner, but I could not find where we can set this as an integrator of the library. |
@elican-doenyas apologies for the delayed response here. The limitation in long-running scans has been around since Android 8.1, but I was unaware that they reduced it from 30 min to 10 min until you reported this issue. The good news is that the library already has a built-in workaround for this as described in #529. The bad news is that the library mechanism to work around this limitation needs to be adjusted to 10 min. I just made a new change that updates the library's interval for long scans from 30 mins to 10 mins match the change in Android #1207 In order to make this work, you have to update to 2.21.0-beta2 (just published today, it may take a few hours to sync) and then enable this option in your manifest as descried in #529 OR easier yet, library version 2.21 and higher has a new settings api that makes this much easier to configure:
|
Fixed in #1207 |
Expected behavior
Beacon scanning should continue as usual independent of the time app is used.
Actual behavior
Beacon scanning stops after ~10 minutes while app is on foreground and enableForegroundServiceScanning is called. This is also reproducible in the AltBeaconReference application.
Steps to reproduce this behavior
Mobile device model and OS version
Samsung S23 - Android 14
Android Beacon Library version
org.altbeacon:android-beacon-library:2.20.5 & org.altbeacon:android-beacon-library:2.20
The text was updated successfully, but these errors were encountered: