open_file icon indicating copy to clipboard operation
open_file copied to clipboard

Remove Unnecessary READ_MEDIA_* Permissions to Comply with Google Play Policy

Open ViktoriaSaklakova opened this issue 9 months ago • 3 comments

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. 🚀

ViktoriaSaklakova avatar Mar 07 '25 14:03 ViktoriaSaklakova

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.

crazecoder avatar Mar 07 '25 15:03 crazecoder

Same issue, Any update ?

Code-Junction-2023 avatar May 04 '25 10:05 Code-Junction-2023

Same issue

soufianebenyaala avatar Jul 22 '25 15:07 soufianebenyaala