-
Notifications
You must be signed in to change notification settings - Fork 609
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
Android: Scan only detects the device after the third consecutive attempt or more #959
Comments
Hi @davixz... certainly sounds interesting! How long are you scanning for on each attempt? From the plugin itself, there's very little change in the scanning paths between those versions. The key impact that I can think of here are all on the Android side of things, due to the higher target SDK versions. As of Android 13, there is a If you are game, it might be worth trying out See this comment for more details: #943 (comment) Let me know how you go! |
Hey @peitschie Thank you for the support, I tried the slim 1.6.3 version but even removing the neverForLocation flag it make very little difference. The scan and connection is not consistent as it were in the past like version 1.2.5 We are using 8000 ms as scan timeout |
Reviewing the changes between those versions, v1.3.1 of the plugin switched to the new I wonder if there is a functional difference between these two interfaces which is causing the behaviour you may be seeing. If you haven't already, can you perhaps try The key one here is to try setting Using |
Thank you so much for the help @peitschie ill try it out |
Hey @peitschie thank you so much! It seems that ble.startScanWithOptions with the option scanMode: "lowLatency" fixes the issue for us! You are the man! |
That's fantastic news @davixz ! Appreciate you taking the time to report back how it's gone. Always nice to resolve an issue 🙂 |
Yes, I too have seen a major drop-off in scanning performance of standard peripherals devices (i.e., non-beacon). And this is in the cozy confines of my office - I shudder to think what we'll see out on a factory floor! I wonder if you will need to change the plugin so it will use the low-latency option by default to accommodate for this severity of performance loss?? The trouble with the low-latency option work-around (above) is that I haven't been using ble.startScanWithOptions() or even ble.startScan(), I use ble.scan(), which takes no options. For now, I suppose I'll need to change to the ble.startScanWithOptions() paradigm. It's too bad one of the options isn't the timeout parameter of the ble.Scan() call! |
I'm not really wanting to replace the OS's default preference here. The impact of the scanning mode is heavily dependent on how frequently the BLE device is advertising, so it's not guaranteed that low latency is important for all (or even most) situations. The downside of defaulting to the low latency mode is that the higher battery usage may get an application flagged to a user as consuming too much battery (unlikely, but it certainly would be a nasty surprise for a developer).
I like this idea! It allows me to lean out the native implementations a bit as well. I'll raise a PR for this (won't get a chance to test & release this weekend probably), but if you're game to try it out or review, any feedback would be welcome @mikerusso-tsi |
@mikerusso-tsi have a look here: #967 If you want to try it out locally, you can install cordova plugins directly from branches like this:
|
Hey guys,
We always used version 1.2.5 and it worked fine.
Now google forced us to update to support android 12+
So we had to move to version 1.5.0+ of this plugin.
But when we do so, we get this problem.
The text was updated successfully, but these errors were encountered: