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

Compliance with Google Play's Photo and Video Permissions policy #2087

Open
bhavesh-lw opened this issue Sep 20, 2024 · 12 comments
Open

Compliance with Google Play's Photo and Video Permissions policy #2087

bhavesh-lw opened this issue Sep 20, 2024 · 12 comments

Comments

@bhavesh-lw
Copy link

bhavesh-lw commented Sep 20, 2024

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.40.2
  • react-native v0.73.6

Platform

Tell us to which platform this issue is related

  • Android

Upcoming android deadline.

There is upcoming android deadline regarding READ_MEDIA_IMAGES permission. As per new google You can only use READ_MEDIA_PERMISSION permission if your app is a gallery app, or if its core functionality is editing, managing, and maintaining photos. Otherwise, you must migrate to the Android photo picker,
or a photo picker of your choice.

Now apps that are using this for picking up profile pictures or other non-core features won't be able to use READ_MEDIA_IMAGES permission after the deadline.

Here is timeline google provided
Screenshot 2024-09-20 at 12 44 30 PM

Detail policy info here

So necessary update to package required in order to access images without READ_MEDIA_IMAGES permission.

@Pauligrinder
Copy link

I found a library that already does this: react-native-photo-picker, and it doesn't look like it'd be very hard to implement. I'll do it myself in the coming weeks unless someone else beats me to it, as I really need this for all the apps I'm maintaining.

I'd be very thankful if someone else did beat me to it though, as I'm not used to developing libraries so I'm having a hard time getting the environment to work properly.

@Pauligrinder
Copy link

I actually got it done already with an as minimal change as possible. I'll post a PR asap.

@julianD77
Copy link

We are using this library in an App using react-native 0.73.6, and both targetSDK and compileSDK at 34, and also now see the new warning in the Play console regarding the READ_MEDIA_IMAGES permission.

We have now tested a version of our App after removing READ_MEDIA_IMAGES permission from the AndroidManifest.xml and so far have not seen any problems opening and selecting images. We have tried against various devices and Android versions going back to Android 8.0 and so far the image picker has worked OK.

Interested to hear from others if they have found devices where this permission is still required. I know the readme of the project states it should be added, but might it only be required for apps with a targetSDK of 33?

NOTE: there is a related/duplicate issue here #2043

@Pauligrinder
Copy link

Pauligrinder commented Sep 22, 2024

@julianD77 I think it's just Android 13+ where that permission is required. I don't remember exactly what happened and on what device/version, but it definitely doesn't work 100% without it.

Either way I also think it's better to use the way Google has suggested to pick images, and it's not a very big deal to upgrade.

@webchun
Copy link

webchun commented Sep 24, 2024

Got the same problem today when pushing a new update for my app.

@Pauligrinder
Copy link

Pull request created: #2093

@leonardorib
Copy link

leonardorib commented Oct 21, 2024

We are using this library in an App using react-native 0.73.6, and both targetSDK and compileSDK at 34, and also now see the new warning in the Play console regarding the READ_MEDIA_IMAGES permission.

We have now tested a version of our App after removing READ_MEDIA_IMAGES permission from the AndroidManifest.xml and so far have not seen any problems opening and selecting images. We have tried against various devices and Android versions going back to Android 8.0 and so far the image picker has worked OK.

Interested to hear from others if they have found devices where this permission is still required. I know the readme of the project states it should be added, but might it only be required for apps with a targetSDK of 33?

NOTE: there is a related/duplicate issue here #2043

I was reading through @Pauligrinder PR and the history on this permission, and testing our app and i had the same result here! Simply removing READ_MEDIA_IMAGES and the picker still worked fine (Android 14).

Either way I also think it's better to use the way Google has suggested to pick images, and it's not a very big deal to upgrade.

But I agree, long term is always best to comply with whatever Google is suggesting

@leonardorib
Copy link

leonardorib commented Oct 21, 2024

I was reading through @Pauligrinder PR and the history on this permission, and testing our app and i had the same result here! Simply removing READ_MEDIA_IMAGES and the picker still worked fine (Android 14).

Looks like this is what happened:

https://android-developers.googleblog.com/2023/04/photo-picker-everywhere.html#:~:text=GET_CONTENT%20takeover

Since our last blog post, we started rolling out support for the GET_CONTENT intent in the Android photo picker whenever the specified MIME type filter matches image/* and/or video/*

https://medium.com/androiddevelopers/permissionless-is-the-future-of-storage-on-android-3fbceeb3d70a#:~:text=ACTION_GET_CONTENT%20behaviour%20change

As we just saw, adopting the Android photo picker requires just a few lines of code. While we want all apps to use it, migration might take some time in your app. That’s why we are bringing the benefits of Android photo picker to existing apps using ACTION_GET_CONTENT by switching the system file picker for the photo picker under the hood without any code change required in the upcoming months. If you launch the ACTION_GET_CONTENT intent with an image and/or video mime type filter, the photo picker will be shown instead of the document picker. For applications, the expected intent results will be the same: a list of Uri.

This explains why we are being able to remove READ_MEDIA_IMAGES and still have the new photo picker working normally even though it is not explicitly implemented.

@scblason
Copy link

@leonardorib Could you explain why we get this library working even with the removed permissions? I tested myself on an Android SDK 34 and I got the same results (library working ok). Is it because this library is using ACTION_GET_CONTENT?

@leonardorib
Copy link

leonardorib commented Oct 22, 2024

@scblason

@leonardorib Could you explain why we get this library working even with the removed permissions? I tested myself on an Android SDK 34 and I got the same results (library working ok). Is it because this library is using ACTION_GET_CONTENT?

Sure! In my previous comment I'm linking the official blog posts from Google where they mention this transition to the new Photo Picker that provides more privacy for users. So if you stick to the new photo picker, don't even need to ask permissions.

And as part of the transition, they state on the post on Medium:

...that’s why we are bringing the benefits of Android photo picker to existing apps using ACTION_GET_CONTENT by switching the system file picker for the photo picker under the hood without any code change required in the upcoming months. If you launch the ACTION_GET_CONTENT intent with an image and/or video mime type filter

And on android-developers.googleblog.com:

Since our last blog post, we started rolling out support for the GET_CONTENT intent in the Android photo picker whenever the specified MIME type filter matches image/* and/or video/*

So they made the Photo Picker show up even if you are using the legacy GET_CONTENT intent with a mime type filter for image or video instead of using the actual photo picker API.

And this is precisely the case for this library as you can see in this function:

private void initiatePicker(final Activity activity) {
try {
final Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT);
if (cropping || mediaType.equals("photo")) {
galleryIntent.setType("image/*");
if (cropping) {
String[] mimetypes = {"image/jpeg", "image/png"};
galleryIntent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
}
} else if (mediaType.equals("video")) {
galleryIntent.setType("video/*");
} else {
galleryIntent.setType("*/*");
String[] mimetypes = {"image/*", "video/*"};
galleryIntent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
}
galleryIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
galleryIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, multiple);
galleryIntent.addCategory(Intent.CATEGORY_OPENABLE);
final Intent chooserIntent = Intent.createChooser(galleryIntent, "Pick an image");
activity.startActivityForResult(chooserIntent, IMAGE_PICKER_REQUEST);
} catch (Exception e) {
resultCollector.notifyProblem(E_FAILED_TO_SHOW_PICKER, e);
}
}

So even though no changes were made in the library code to invoke the new Photo Picker, it is still able to do it since Google implemented the switch on their side. This is why the package is working even if you remove READ_MEDIA_IMAGES.

@scblason
Copy link

@leonardorib thank you very much for the thorough response. I saw the same in the code and I wanted to validate if this was the correct conclusion. I did more test in different devices and I haven't had any issues after removing the permissions.

@aleksamrakovic
Copy link

any news regarding this issue?

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

7 participants