переопределить fun onReceive(p0: Context?, Intent: Intent?) {
if(intent?.action == BluetoothDevice.ACTION_FOUND){
val устройство = Intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE)
val list = mutableSetOf()
list.addAll(discoveryAdapter.currentList)
if(device != null) список. add(ListItem(device, false))
discoveryAdapter.submitList(list.toList())
binding.tvEmptySearch.visibility = if(list.isEmpty()) View.VISIBLE else View.GONE
try{
Log.d("MyLog", "Device: ${device?.name}")
} catch (e: SecurityException){
Код: Выделить всё
}
} else if(intent?.action == BluetoothDevice.ACTION_BOND_STATE_CHANGED){
getPairedDevices()
} else if(intent?.action == BluetoothAdapter.ACTION_DISCOVERY_FINISHED){
binding.imBluetoothSearch.visibility = View.VISIBLE
binding.pbSearch.visibility = View.GONE
}
}
}`
Код: Выделить всё
your text
Подробнее здесь: https://stackoverflow.com/questions/781 ... oid-studio