File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
system/src/main/java/io/github/sds100/keymapper/system/bluetooth Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -45,12 +45,13 @@ class AndroidBluetoothAdapter @Inject constructor(
4545 onReceiveIntent(intent)
4646 }
4747 }
48-
4948 init {
5049 IntentFilter ().apply {
5150 // these broadcasts can't be received from a manifest declared receiver on Android 8.0+
5251 addAction(BluetoothDevice .ACTION_BOND_STATE_CHANGED )
5352 addAction(BluetoothAdapter .ACTION_STATE_CHANGED )
53+ addAction(BluetoothDevice .ACTION_ACL_CONNECTED )
54+ addAction(BluetoothDevice .ACTION_ACL_DISCONNECTED )
5455
5556 ContextCompat .registerReceiver(
5657 ctx,
@@ -112,9 +113,9 @@ class AndroidBluetoothAdapter @Inject constructor(
112113 coroutineScope.launch {
113114 val address = device.address ? : return @launch
114115 val name = device.name ? : return @launch
115- val bondState = intent.getStringExtra (BluetoothDevice .EXTRA_BOND_STATE )
116+ val bondState = intent.getIntExtra (BluetoothDevice .EXTRA_BOND_STATE , - 1 )
116117
117- Timber .i(" On Bluetooth device bond state changed to ${ bondState.toString()} : $name " )
118+ Timber .i(" On Bluetooth device bond state changed to $bondState : $name " )
118119
119120 onDevicePairedChange.emit(
120121 BluetoothDeviceInfo (
You can’t perform that action at this time.
0 commit comments