tbfp
tbfp

Reputation: 153

How do I know if a BLE scan is ongoing?

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

Answers (1)

doncoleman
doncoleman

Reputation: 2283

If bluetoothAdapter.isDiscovering() returns true, the device is scanning.

https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#isdiscovering

Upvotes: 6

Related Questions