Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in scanning #124

Open
flutter-max opened this issue Aug 13, 2022 · 2 comments
Open

Error in scanning #124

flutter-max opened this issue Aug 13, 2022 · 2 comments

Comments

@flutter-max
Copy link

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

@wahedzaman
Copy link

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" />

@fathah
Copy link

fathah commented Aug 20, 2023

Try checking for permission

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants