Clear existing devices when starting a new scan.
This commit is contained in:
parent
72b9eaa61d
commit
bc7c83d867
1 changed files with 3 additions and 0 deletions
|
@ -47,6 +47,9 @@ class ScannerActivity : ComponentActivity() {
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
private fun startScanning() {
|
private fun startScanning() {
|
||||||
|
// Clear existing devices when starting a new scan.
|
||||||
|
scannedDevices.clear()
|
||||||
|
|
||||||
val bluetoothManager = getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
|
val bluetoothManager = getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
|
||||||
val scanner = bluetoothManager.adapter.bluetoothLeScanner ?: run {
|
val scanner = bluetoothManager.adapter.bluetoothLeScanner ?: run {
|
||||||
Log.e(TAG, "BLE scanning not supported")
|
Log.e(TAG, "BLE scanning not supported")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue