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] getAssetPathList returns empty in android 12 and 13 #908

Closed
Mohammad-Hosein88 opened this issue Mar 12, 2023 · 1 comment
Closed

Comments

@Mohammad-Hosein88
Copy link

Mohammad-Hosein88 commented Mar 12, 2023

Describe the bug
I have been using this package in our project with no issues but since I installed it in on android 13 it won't return albums list from getAssetPathList method. I tried it on android 11 it works fine. here is the code to reproduce:

    var result = await PhotoManager.requestPermissionExtend();
    if (result.isAuth) {
      // success
//load the album list
      List<AssetPathEntity> albums = await PhotoManager.getAssetPathList(type: RequestType.image, onlyAll: true);
      List<AssetEntity> media = [];
      if (albums.isNotEmpty) {
        media = await albums[0].getAssetListPaged(page: page, size: 60);
      }
      if (page == 0) {
        widget.onInitialize(media.isNotEmpty);
      }
      if (media.isEmpty) {
        lastPage = page;
        return;
      }
      if (page == 0) {
        _selectAsset(media.first);
      }
        setState(() {
          _mediaList.addAll(media.map((asset) => AppAssetEntity(asset)));
        });

      scrollPosition.allLoaded = media.isEmpty;
      scrollPosition.loading = false;
    } else {
      // fail
      PhotoManager.openSetting();

      /// if result is fail, you can call `PhotoManager.openSetting();`  to open android/ios applicaton's setting to get permission
    }
@AlexV525
Copy link
Member

Duplicate of #852

@AlexV525 AlexV525 marked this as a duplicate of #852 Mar 12, 2023
@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2023
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

2 participants