wu9007 / qrcode_scanner

🛠 Flutter QR code scanner plugin.
MIT License
358 stars 185 forks source link

Unnecessarily asking for permission to access storage at startup #69

Closed femrek closed 3 years ago

femrek commented 3 years ago

I am using this lib for just scan qrcode and i don't need storage permission but if i add qrscan to dependencies, storage permission dialog is shown by default.

If i remove lines about storage permission in the following files, the problem disappears but this modify is ​​only available on my computer (If someone compiles my project's source code this problem will repeat). https://github.com/leyan95/qrcode_scanner/blob/master/android/src/main/java/com/shinow/qrscan/CheckPermissionUtils.java https://github.com/leyan95/qrcode_scanner/blob/master/android/src/main/AndroidManifest.xml

(i only tried this lib on android app)

ndhbr commented 3 years ago

Same here

rajkumar82 commented 3 years ago

The thing is my project uses scanner, shared preferences and back ground fetch.

qrscan: ^0.2.19 shared_preferences: ^0.5.12 background_fetch: ^0.6.0

We have configured a task that should execute headless. While executing the task, we try to read and write using shared preference.

However due to qrscan, the following issue occurs.

from backgroundFetchHeadlessTask smartscaffolder.smartinspector.sync [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)

This error occurs if I remove off qrscan from my pubspec.yaml.

It will be very helpful to get this fixed at the earliest.

rajkumar82 commented 3 years ago

@leyan95 Can you please publish a fix for this issue ?

wu9007 commented 3 years ago

@rajkumar82 Please try upgrading to the latest version - 0.2.20 Need to request permission in your own project

await Permission.camera.request();
String barcode = await scanner.scan();
rajkumar82 commented 3 years ago

Thank you very much for the quick support !! Version 0.2.20 works as expected.

ndhbr commented 3 years ago

This ticket was about asking unnecessarily for permissions at app startup? Why do you close it as it is not fixed?

wu9007 commented 3 years ago

@ndhbr Sorry, I was under the impression that it had been fixed in the latest version

ndhbr commented 3 years ago

@leyan95 No problem, but thanks for the plugin.

femrek commented 3 years ago

This issue is solved with this commit: https://github.com/leyan95/qrcode_scanner/commit/c7f6f87e70a9b65ae1cfbb3fc2b4fa4d3afc137b

Thanks for fix