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

Remove Unnecessary READ_MEDIA_* Permissions to Comply with Google Play Policy #327

Open
ViktoriaSaklakova opened this issue Mar 7, 2025 · 1 comment

Comments

@ViktoriaSaklakova
Copy link

Hello,

We are using open_file in our Flutter project and recently received a Google Play policy compliance notice regarding the Photo and Video Permissions policy. According to this policy, apps must remove the READ_MEDIA_IMAGES and READ_MEDIA_VIDEO permissions unless they are essential for core functionality.
Issue

Currently, open_file requests READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, and READ_MEDIA_AUDIO permissions, even when they are not required to open files. This behavior is problematic because:

Google Play is enforcing a stricter permission policy starting January 22, 2025.
If an app retains these permissions without a valid reason, it risks removal from the Play Store.
Opening files using system tools (e.g., Media Provider, Photo Picker, SAF) does not require these permissions.
Removing these permissions from our native code does not affect functionality, meaning they are unnecessary in open_file.

Code Reference in doOpen() Method

The following snippet unnecessarily blocks file opening if READ_MEDIA_* permissions are not granted:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && FileUtil.isExternalStoragePublicMedia(filePath, mimeType)) {
    if (FileUtil.isImage(mimeType) && !hasPermission(Manifest.permission.READ_MEDIA_IMAGES) && !Environment.isExternalStorageManager()) {
        result(-3, "Permission denied: " + Manifest.permission.READ_MEDIA_IMAGES);
        return;
    }
    if (FileUtil.isVideo(mimeType) && !hasPermission(Manifest.permission.READ_MEDIA_VIDEO) && !Environment.isExternalStorageManager()) {
        result(-3, "Permission denied: " + Manifest.permission.READ_MEDIA_VIDEO);
        return;
    }
    if (FileUtil.isAudio(mimeType) && !hasPermission(Manifest.permission.READ_MEDIA_AUDIO) && !Environment.isExternalStorageManager()) {
        result(-3, "Permission denied: " + Manifest.permission.READ_MEDIA_AUDIO);
        return;
    }
}

Request

To ensure compliance with Google Play policies, we request the following changes:

Remove or make READ_MEDIA_* permissions optional in open_file.
Use alternative solutions (e.g., MediaStore, SAF, or Intent.ACTION_VIEW) that do not require broad storage access.
Ensure apps can use open_file without unnecessary permission requests, to comply with Google Play policies.

Google Play Policy Reference:

Google Play Photo and Video Permissions Policy

This issue affects all developers using open_file. If not resolved, apps using this library may fail Play Store compliance checks starting January 22, 2025.

Thank you for your work on this package! Looking forward to your response. 🚀

@crazecoder
Copy link
Owner

FileUtil.isNeedPermission(filePath)

It determines if the app can open the file, and if it can, it won't ask for permission.
And the latest version does not declare any permissions in the manifest file.

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