Reputation: 42
I am working on a mobile app where I am doing the following to get the data from my sensors.
I start/restart the scan using the following statement
scanner.startScan(scanFilters,scanSettings,callback);
I stop the scan using the following statement
scanner.stopScan(callback);
In scanFilters
, I set the name of my device ID and In scanSettings
I set the scan mode to LOW_LATENCY
The app works fine most of the time. But sometimes I get some complaints from my customers that eventhough bluetooth and location are on, there is no data update. The sensors are working fine. When I start a blueooth LE scan how to ensure that the scan is actually running or not?. I there anywhere that I can get a status of the scan running or no.
Upvotes: 2
Views: 1529
Reputation: 2663
Since you are saying that this happens only for some customers there might be another source of your problem.
BLE needs the ACCESS_FINE_LOCATION permission to work for devices running an Android version lower than 8.0. Higher version can use the Device Companion Pairing. You might have added the Permission to your apps manifest file like this:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
But it is safer to also check for this permission at runtime and request it if not granted. Have a look at this page for more informations about how to request permissios from the user at runtime.
Upvotes: 1