Clear existing devices when starting a new scan.

This commit is contained in:
Joe Kearney 2025-03-01 12:06:41 -06:00
parent 72b9eaa61d
commit bc7c83d867

View file

@ -47,6 +47,9 @@ class ScannerActivity : ComponentActivity() {
@SuppressLint("MissingPermission")
private fun startScanning() {
// Clear existing devices when starting a new scan.
scannedDevices.clear()
val bluetoothManager = getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
val scanner = bluetoothManager.adapter.bluetoothLeScanner ?: run {
Log.e(TAG, "BLE scanning not supported")