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

BLE scan android when screen is locked #987

Closed
younesspotmaster opened this issue Aug 24, 2023 · 1 comment · Fixed by #989
Closed

BLE scan android when screen is locked #987

younesspotmaster opened this issue Aug 24, 2023 · 1 comment · Fixed by #989
Labels

Comments

@younesspotmaster
Copy link
Contributor

younesspotmaster commented Aug 24, 2023

Since android 8.1.0, android doesn't allow scanning without filters when the phone is locked. A work around for this is adding an empty filter. More info in this stackoverflow: https://stackoverflow.com/questions/48077690/ble-scan-is-not-working-when-screen-is-off-on-android-8-1-0

Is it possible to add an option for adding an empty filter? Or change the standard empty services array [] to use an empty filter instead of no filter.

@peitschie
Copy link
Collaborator

peitschie commented Aug 25, 2023

Hi @younesspotmaster

I agree the plugin currently doesn't support this use case. I'd definitely accept a patch though to add this.

The best approach here would be to add a forceScanFilter option to the https://github.com/don/cordova-plugin-ble-central#startscanwithoptions parameter list. This flag could then be used at https://github.com/don/cordova-plugin-ble-central/blob/master/src/android/BLECentralPlugin.java#L1251 to ensure a filter is created if none already exist.

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

Successfully merging a pull request may close this issue.

2 participants