esc_pos_bluetooth icon indicating copy to clipboard operation
esc_pos_bluetooth copied to clipboard

Error in scanning

Open flutter-max opened this issue 2 years ago • 2 comments

Hi, i faced this error when the app start scanning.

[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: PlatformException(startScan, Need android.permission.BLUETOOTH_SCAN permission for AttributionSource { uid = 10479, packageName = com.example.test_app, attributionTag = null, token = android.os.BinderProxy@899cb68, next = null }: GattService registerScanner, null, null)

i dont know whats the solution, please help me. thanks

flutter-max avatar Aug 13 '22 20:08 flutter-max

goto your project -> android -> app -> src -> package name -> AndroidManifest.xml and paste the below code before tag begins.. then stop the app and run again

<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" /> <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

wahedzaman avatar Aug 21 '22 10:08 wahedzaman

Try checking for permission

  void initBTprinter() async {
    await Permission.bluetoothScan.isDenied.then((value) {
if (value) {
  Permission.bluetoothScan.request();
  printerManager.startScan(Duration(seconds: 2));
}
});
}

fathah avatar Aug 20 '23 08:08 fathah