FlutterBleLib icon indicating copy to clipboard operation
FlutterBleLib copied to clipboard

Android 12 error: could not find callback wrapper

Open lpc-nz opened this issue 3 years ago • 7 comments

Hi everyone I am working on the Bluetooth connection and I have some problems with the new Android version. Most Android phones work perfectly except for some Samsung phones (S21, S21 +). Does anyone know about these issues? Please give me some help.

I have tried to add permission but it still has no luck.

minSdkVersion 21
targetSdkVersion 31
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
I/flutter (23844): DeviceService - waiting for power on - BluetoothState.POWERED_ON
I/flutter (23844): DevicesScanningBloc - start scan
D/com.polidea.flutter_ble_lib.FlutterBleLibPlugin(23844): on native side observed method: startDeviceScan
I/BluetoothAdapter(23844): STATE_ON
I/BluetoothAdapter(23844): STATE_ON
I/BluetoothAdapter(23844): STATE_ON
I/BluetoothAdapter(23844): STATE_ON
D/BluetoothLeScanner(23844): Start Scan with callback
I/BluetoothAdapter(23844): STATE_ON
I/BluetoothAdapter(23844): STATE_ON
D/BluetoothLeScanner(23844): could not find callback wrapper

lpc-nz avatar May 17 '22 23:05 lpc-nz

Any update on this?

iJack93 avatar Nov 09 '22 18:11 iJack93

Have the same issue with Bluetooth on android 12, on 10 and 11 works perfectly. Adding additional permissions required by Android 12 and updating OS to the latest version did not change anything.

georgechem avatar Mar 31 '23 11:03 georgechem

@georgechem I've found that you have to add at first these permissions inside the AndroidManifest and through a Permission manager ask for them to the user

    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

Then you have to target at least api 33 of Android, otherwise it won't work and won't event ask for those. I think that this is not related to this library, but to Android itself.

iJack93 avatar Mar 31 '23 12:03 iJack93

Thanks a lot I will try.

georgechem avatar Mar 31 '23 12:03 georgechem

Screen Shot 2023-03-31 at 13 50 46

It did not work - looks like permissions are granted but nothing happen beside this. It is SONY-XQ-AS-52

georgechem avatar Mar 31 '23 12:03 georgechem

Capture This is my Flutter app error in the Bluetooth. Can someone solve my error?

rohailmansab avatar Oct 07 '23 07:10 rohailmansab