-
Notifications
You must be signed in to change notification settings - Fork 582
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
Handle undocumented Android 7 scan throttle #227
Comments
Hello @leof23 |
yes, that was my issue, thanks for the answer |
I will keep this issue opened as a reminder for me. |
#227 Android API 24 (7.0) introduced an undocomented “feature” that aims on applications that try to start too many scans (5+) in a short time window (30 seconds) by silently (log error only) not starting the scan. More info available here: https://blog.classycode.com/undocumented-android-7-ble-behavior-changes-d1a9bd87d983
#227 Android API 24 (7.0) introduced an undocumented “feature” that aims on applications that try to start too many scans (5+) in a short time window (30 seconds) by silently (log error only) not starting the scan. More info available here: https://blog.classycode.com/undocumented-android-7-ble-behavior-changes-d1a9bd87d983
Is available in |
I'm seeing something similar to this:
It's happening on multiple devices running on various versions of Android up to and including those running Android Pie. What I think would be nice, is if a flag could be set for RxAndroidBle that tells it to automatically scan at the suggested retry time. That time seems like it's around 10 seconds or so into the future most of the time. |
Feel free to add a feature request though I think it is simple to create it without bloating the library's code base by utilising |
Make sure you are not calling the |
@devDeejay It's look like below .scanBleDevices(scanSetting, scanFilters)
.retryWhen {
it.flatMap { error ->
when (error) {
is BleScanException -> {
Observable.timer(5000, TimeUnit.MILLISECONDS)
}
and sometimes I got same error in this issue. |
Actually , I got this error
|
Hey @vegeta2102
Please check the merged PR above description. It has a good description and a link to source where I learned about this behaviour. TL;DR — one can start up to 5 scans every 30 seconds. |
@dariuszseweryn |
Summary
Hi, I'm developing an app for reading a ble device, I'm using a Switch to control the Scan event, if I pass the switch between on/off quickly, sometimes I received results but later, after some calls to the event, I don't receive more results, I'm using a Samsung Galaxy tab s2 with Android 7, and using Kotlin for my code
Minimum code snippet reproducing the issue
My Scan method
Logs from the application running
Actual result
As you can see in the log, in the final part the method only reach to the doOnSubscribe, but never scan again until i turn the switch on/off again
Expected result
My spected result is whenever i activate the switch, I need to scan util I can found the device
The text was updated successfully, but these errors were encountered: