Skip to content
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

when the user puts the app to background and then foreground more than 5 times within 30 seconds, app gets "scanning too frequently error" #1199

Open
elican-doenyas opened this issue Jul 12, 2024 · 1 comment

Comments

@elican-doenyas
Copy link

Expected behavior

The library should check the scan start's, to prevent the OS from limiting the app with the error:
"App 'com.xx.yy' is scanning too frequently"
This causes the OS to block mentioned app from getting ble scan results for a brief period of time.

Actual behavior

The library does not check the scan start's when app is backgrounded and then foregrounded. Hence, this causes the OS to block the app from getting scan results due to exceeding the 5 start/stop limit within 30 seconds enforced by the OS.

Steps to reproduce this behavior

1- Put the app to background then after 1 second, back to foreground. Repeat 6-7 times
2- Observe the "App 'com.xx.yy' is scanning too frequently" error log
3- Observe to ble scan results do not get delivered to the app

Mobile device model and OS version

Samsung S23(SM-S911B) - Android 14 / API 34

Android Beacon Library version

implementation 'org.altbeacon:android-beacon-library:2.20.3'

@VolodaUa
Copy link

This pull request could improve the situation a bit when we have navigation because I observed the same issue.

#1195

I think we don't need to stop foreground scan if it's active, but switch to background mode when:
Possible options:

  • after 30s(as example)
  • once the foreground scan job is finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants