chipweinberger / flutter_blue_plus

Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android, iOS, macOS
Other
790 stars 478 forks source link

[Bug]: Android 12: pairing popup appears twice #429

Closed mitchellilr closed 10 months ago

mitchellilr commented 1 year ago

Hi,

When connecting to a BLE device which requires bonding, the "Tap to pair" action notification appears twice in a row.

Thanks

mitchellilr commented 1 year ago
2x D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getConnectedDevices
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getAdapterState
D/InputConnectionAdaptor( 7264): The input method toggled cursor monitoring off
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: startScan
D/BluetoothAdapter( 7264): isLeEnabled(): ON
D/BluetoothLeScanner( 7264): onScannerRegistered() - status=0 scannerId=10 mScannerId=0
12x D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getAdapterState
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getConnectionState
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: stopScan
D/BluetoothAdapter( 7264): isLeEnabled(): ON
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: stopScan
D/BluetoothAdapter( 7264): isLeEnabled(): ON
D/BluetoothLeScanner( 7264): could not find callback wrapper
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: connect
D/BluetoothGatt( 7264): connect() - device: 91:38:0B:A9:C5:BA, auto: false
D/BluetoothGatt( 7264): registerApp()
D/BluetoothGatt( 7264): registerApp() - UUID=4417a33d-3cd6-4d04-92d5-4245a2df0719
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getConnectionState
D/BluetoothGatt( 7264): onClientRegistered() - status=0 clientIf=10
D/BluetoothGatt( 7264): onClientConnectionState() - status=0 clientIf=10 device=91:38:0B:A9:C5:BA
D/[FBP-Android]( 7264): [FBP-Android] onConnectionStateChange: status: 0 newState: 2
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: clearGattCache
W/.[app name]( 7264): Accessing hidden method Landroid/bluetooth/BluetoothGatt;->refresh()Z (unsupported, reflection, allowed)
D/BluetoothGatt( 7264): refresh() - device: 91:38:0B:A9:C5:BA
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getConnectionState
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: discoverServices
D/BluetoothGatt( 7264): discoverServices() - device: 91:38:0B:A9:C5:BA
D/BluetoothGatt( 7264): onConnectionUpdated() - Device=91:38:0B:A9:C5:BA interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt( 7264): onSearchComplete() = Device=91:38:0B:A9:C5:BA Status=0
D/[FBP-Android]( 7264): [FBP-Android] onServicesDiscovered: count: 3 status: 0
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: setNotification
D/BluetoothGatt( 7264): setCharacteristicNotification() - uuid: 0000abf2-0000-1000-8000-00805f9b34fb enable: true
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getConnectionState
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getConnectedDevices
D/[FBP-Android]( 7264): [FBP-Android] onDescriptorWrite: uuid: 00002902-0000-1000-8000-00805f9b34fb status: 0
D/BluetoothGatt( 7264): onConnectionUpdated() - Device=91:38:0B:A9:C5:BA interval=36 latency=0 timeout=500 status=0
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: requestMtu
D/BluetoothGatt( 7264): configureMTU() - device: 91:38:0B:A9:C5:BA mtu: 512
2x D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getMtu
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: requestMtu
D/BluetoothGatt( 7264): configureMTU() - device: 91:38:0B:A9:C5:BA mtu: 512
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getMtu
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: requestMtu
D/BluetoothGatt( 7264): configureMTU() - device: 91:38:0B:A9:C5:BA mtu: 512
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getMtu
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: requestMtu
D/BluetoothGatt( 7264): configureMTU() - device: 91:38:0B:A9:C5:BA mtu: 512
D/BluetoothGatt( 7264): onConfigureMTU() - Device=91:38:0B:A9:C5:BA mtu=512 status=0
D/[FBP-Android]( 7264): [FBP-Android] onMtuChanged: mtu: 512 status: 0
D/[FBP-Android]( 7264): [FBP-Android] onMethodCall: getMtu

The popups occur after this last line in the log and produce no new logs of their own.

chipweinberger commented 1 year ago

https://github.com/PhilipsHue/flutter_reactive_ble/issues/507

It is a bug in android 12^

i'll keep this issue open so it does not get refiled.

DukeJeon commented 1 year ago

same issue in Android 13

samnbd commented 11 months ago

You can call createBond() yourself just after connecting and this will resolve the issue

Neuroquila-n8fall commented 10 months ago

I double that what @samnbd suggested. Not only because "it just works" but because it will automatically circumvent any weirdness that is built into the OS flavor. At the end of the day it's about UX.

chipweinberger commented 10 months ago

closed. i added this to the readme common problems.