Reputation: 4283
I'm using BluetoothLeScanner
to scan for BLE devices, which I start using:
startScan(null, settings.getScanSettings(), scanCallback);
Every once in a while, a call to startScan()
does not discover any BLE device, even though some devices are actually advertizing (They are discovered using nRF Connect app).
When this happens, the next call to stopScan()
and startScan()
does discover devices.
I know that since Android 7, the number of start and stop scans is restricted to 5 times in a window of 30 seconds. However, I've noticed the problem sometimes also occurs if no stopScan()
/startScan()
has been called for more than 30 secs.
Has anyone experienced such issue ? Could it be something else my app is doing while starting the scanner that could the scanning to fail ?
I have this problem using Android 10 and lower versions.
Upvotes: 3
Views: 606
Reputation: 1
Android phone limited BLE scan duration to save energy. So you can not scan BLE advertising for a long time. It is system limitation so APP layer have no way to change that.
In older phone (maybe under 4.4) do not set the limitation, but it will make the phone getting hot.
If you want to scan BLE advertisement for a long time, change your design is a better way.
Upvotes: 0