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

[Bug report] Permission return error #1256

Closed
NightRannie opened this issue Jan 10, 2025 · 3 comments
Closed

[Bug report] Permission return error #1256

NightRannie opened this issue Jan 10, 2025 · 3 comments

Comments

@NightRannie
Copy link

Version

3.6.3

Platforms

Android

Device Model

xiaomi(Androind 14)

flutter info

[✓] Flutter (Channel stable, 3.22.2, on macOS 14.6 23G80 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.22.2 on channel stable at /Users/admin/application/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (7 months ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/admin/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/admin/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/admin/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2023.3)
    • 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 17.0.10+0-17.0.10b1087.21-11572160)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • 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

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

[✓] Connected device (3 available)
    • 2201123C (mobile) • 4850a4c4 • android-arm64  • Android 14 (API 34)
    • macOS (desktop)   • macos    • darwin-x64     • macOS 14.6 23G80 darwin-x64
    • Chrome (web)      • chrome   • web-javascript • Google Chrome 131.0.6778.265
    ! Error: Browsing on the local area network for 谢勋的iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

How to reproduce?

选择部分 后权限没有返回PermissionState.limited,而是返回PermissionState.authorized,需要重启后才返回的PermissionState.limited,如果重新代用下列方法也是返回的PermissionState.authorized,怎么才能获取到正确的权限

Directory directory = await getTemporaryDirectory();
tempPath = directory.path;
// PhotoManagerPlugin().presentLimited(type)

PermissionState state = await PhotoManagerPlugin()
    .requestPermissionExtend(PermissionRequestOption());

PermissionState state1 = await PhotoManager.getPermissionState(
    requestOption: PermissionRequestOption(
        androidPermission:
            AndroidPermission(type: widget.type, mediaLocation: false)));



print('state===$state  state1===$state1');[](url)

WechatIMG6
1736492235348

Logs

No response

Example code (optional)

Future<bool> initPermission() async {
    Directory directory = await getTemporaryDirectory();
    tempPath = directory.path;
    // PhotoManagerPlugin().presentLimited(type)
   
    PermissionState state = await PhotoManagerPlugin()
        .requestPermissionExtend(PermissionRequestOption());

    PermissionState state1 = await PhotoManager.getPermissionState(
        requestOption: PermissionRequestOption(
            androidPermission:
                AndroidPermission(type: widget.type, mediaLocation: false)));



    print('state===$state  state1===$state1');
    permissionLimited = state == PermissionState.limited;
    return state != PermissionState.limited &&
        state != PermissionState.authorized;
  }

Contact

[email protected]

@fluttercandies-dev
Copy link

AI Summary: 用户在使用 photo_manager 3.6.3 版本时,在 Android 14 的小米设备上,选择部分照片权限后,插件错误地返回了 authorized 状态,而不是 limited

@NightRannie
Copy link
Author

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

@NightRannie
Copy link
Author

添加上面的权限后正常

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

No branches or pull requests

2 participants