Код: Выделить всё
Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.bluetooth.device.action.ACL_DISCONNECTED
Код: Выделить всё
Код: Выделить всё
private fun setBluetoothReceiver() {
val filter = IntentFilter(BluetoothDevice.ACTION_FOUND)
filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED)
filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED)
filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED)
registerReceiver(bluetoothReceiver, filter)
}
Код: Выделить всё
val local = Intent()
local.setAction(BluetoothDevice.ACTION_ACL_DISCONNECTED)
local.putExtra("number", device.name)
if (context != null) {
context.sendBroadcast(local)
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... sconnected
Мобильная версия