React-native-ble-plx: Does device scan work when phone is locked?

Created on 22 Dec 2020  路  5Comments  路  Source: Polidea/react-native-ble-plx

Hello!

I use react-native-ble-plx to scan devices and it works well while the phone isn't locked. When I lock the phone the scan stops. After device is unlocked scan works again.

So is it possible to scan BLE devices while the phone is locked?

I use LowLatency mode for scanning and phone with Android 10.

{ scanMode: ScanMode.LowLatency }
question

All 5 comments

It is but your app needs to have proper permission granted by the user (to use always) and you need to use scan filters.

@dariuszseweryn, I added android.permission.ACCESS_BACKGROUND_LOCATION to AndroidManifest.xml and enabled "Allow all the time" in settings but it seems to have no effect. What filters and permissions should I add to make it work?

Filters adequate for the advertisement of the peripheral you are interested it. You cannot "scan everything" in the background because it may be used to locate the user.

So I need to add UUIDs list for correct background scan, right?

Right

Was this page helpful?
0 / 5 - 0 ratings

Related issues

devgeno picture devgeno  路  4Comments

adyanced picture adyanced  路  5Comments

alfacommunication-alessandro picture alfacommunication-alessandro  路  3Comments

mitaxe picture mitaxe  路  3Comments

biks152207 picture biks152207  路  3Comments