juliuscanute / qr_code_scanner

QR Code Scanner for Flutter
BSD 2-Clause "Simplified" License
999 stars 759 forks source link

[BUG] Endless request for permission to use the camera #604

Closed mnurtay closed 1 year ago

mnurtay commented 1 year ago

BUG

My team and I discovered a bug when an application requests permission to use the camera and we forbid it, it endlessly repeats asking for permission.

The bug is reproduced only in android devices. Except Android version 12 (everything works fine here).

Gif:

Flutter Information

[✓] Flutter (Channel stable, 3.3.3, on macOS 12.6 21G115 darwin-x64, locale en-KZ)
    • Flutter version 3.3.3 on channel stable at /usr/local/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18a827f393 (13 days ago), 2022-09-28 10:03:14 -0700
    • Engine revision 5c984c26eb
    • Dart version 2.18.2
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/mnurtay/Library/Android/sdk
    • Platform android-33, build-tools 32.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A309
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.72.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.50.0

[✓] Connected device (2 available)
    • macOS (desktop)          • macos                     • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)             • chrome                    • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Solution

When we click on the "Deny" button, the onResume function is called again. It in turn re-checks the permission. This can be seen in the screenshot below. (link to the code: line 55)

3yPxrO3un4LX

In order for everything to function properly, we have removed this part of the code. #603

ykf690zjANi

We are waiting for a corrected new version of the package from the contributors! @juliansteenbakker @juliuscanute Pull request: #603

mnurtay commented 1 year ago

this issue has been fixed in commit: https://github.com/juliuscanute/qr_code_scanner/commit/03f62759ee1c9861804dbc950312c8cbde6abec6