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

[How to use] Android API 34 ACCESS_MEDIA_LOCATION is denied if user selected limited access to photos and videos #1089

Closed
StigUK opened this issue Feb 23, 2024 · 3 comments

Comments

@StigUK
Copy link

StigUK commented Feb 23, 2024

Platforms

Android

Description

I am requesting access to media files on Android 14 (api 34) using PhotoManager (version 3.0.0-dev.5).
Provided that the user chooses not full, but limited access to the gallery of permissions, ACCESS_MEDIA_LOCATION is always returned as denied. This means I can't get coordinates from the metadata of a photo or video.

If the user gives full access, then the ACCESS_MEDIA_LOCATION status is returned as granted.

I don’t know for sure whether this is a library bug, or whether it’s a feature of API 34, which is why I didn’t file this as a bug report.

My code

import 'package:photo_manager/photo_manager.dart';
import 'package:permission_handler/permission_handler.dart';

Future test() async {
final PermissionState permissionState = await PhotoManager.requestPermissionExtend();
final PermissionStatus accessMediaLocationStatus = await Permission.accessMediaLocation.status;
///If permissionState is limited => accessMediaLocationStatus is denied
///If permissionState is authorized => accessMediaLocationStatus is granted
}

Try do it

No response

@ashilkn
Copy link

ashilkn commented Mar 30, 2024

@StigUK
I was facing ACCESS_MEDIA_LOCATION denied/not-requested issue on photo_manager v2.8.1. It's not exactly your issue, but this helped me resolve mine.

 final permissionState = await PhotoManager.requestPermissionExtend(
        requestOption: const PermissionRequestOption(
          androidPermission: AndroidPermission(
            type: RequestType.common,
            mediaLocation: true,
          ),
        ),
      );

mediaLocation is set to false by default, changing it fixed my issue. See if this works for you as well?

@mozammal-Hossain-dev
Copy link

@StigUK , you can try @ashilkn's solution and also give the below permission for the Android:

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

These procedures solved the issue for Android API 34.

@AlexV525
Copy link
Member

as #1089 (comment) explained

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

4 participants