Reputation: 153
My app is scanning for devices when in the foreground and parses the ble advertisement data and displays it. The scanning and parsing are controlled by a state machine. I'm getting frequent scan fails and hence restarting the scan. How would I check if the scan is ongoing before starting another?
Upvotes: 3
Views: 1634
Reputation: 2283
If bluetoothAdapter.isDiscovering()
returns true, the device is scanning.
https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#isdiscovering
Upvotes: 6