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

Android 13 support - PhotoViewer unable to open image as permission changed #235

Open
vishal-revdiwala opened this issue May 25, 2023 · 20 comments

Comments

@vishal-revdiwala
Copy link

Behavior changes: Apps targeting Android 13 or higher
https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions

Plugin doesn't support. Please update accordingly.

@AbidR-S2
Copy link

AbidR-S2 commented Jun 7, 2023

I've just made a new pull request to fix this issue #236
Tested that it is working using Samsung Tab Active 3s. One of them running Android 13 and the other running Android 12. Both are previewing files correctly.

@cmohanraj10
Copy link

@AbidR-S2 We are still facing the issue and can't open the image. We can see Photos and videos permission under App Info and doesn't work even after enabling it manually.

Here is our config XML :

<plugin name="com-sarriaroman-photoviewer"/>

<config-file parent="/manifest" target="AndroidManifest.xml">
	<uses-permission android:name="android.permission.INTERNET" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" android:minSdkVersion="33" />
</config-file>

Any solution?

@AbidR-S2
Copy link

AbidR-S2 commented Oct 5, 2023

Are you installing the original plugin or my specific pull request with my code changes.
Even if you make those changes in your config XML, the plugin itself needs code changes to work in Android 13 and also backwards compatibility for Android 12 or less.

You can see those code changes here https://github.com/sarriaroman/photoviewer/pull/236/files
The new conditionals around getting permissions is required to view pictures.

@banothurameshnaik
Copy link

We are facing the same issue and tried different solutions.
Finally, I was able to find this PR mentioned above by @AbidR-S2.
Since PR is still open, I copied all the changes suggested in the PR into my codebase and it worked well.
Thanks @AbidR-S2

@jorgedferreira
Copy link

jorgedferreira commented Aug 14, 2024

@banothurameshnaik and @AbidR-S2 , I've made the changes in the local code (inside node_modules - I know it's not the best solution and I'll change it afterwards) but it still doesn't work. It doesn't ask for permissions.

I've done a cordova platform rm android && cordova platform add android@13 but still nothing...

How can i best solve this? Any help appreciated and thanks for your hard work!

Update: I've actually "solved" the issue by doing this:

Remove current plugin: cordova plugin remove com-sarriaroman-photoviewer

Add the plugin but using @AbidR-S2 PR: cordova plugin add https://github.com/sarriaroman/photoviewer.git#pull/236

@rolinger
Copy link

@jorgedferreira @AbidR-S2 -

For some reason dropping and re-adding the plugin fails with: cordova plugin add https://github.com/sarriaroman/photoviewer.git#pull/236

I get the following error:

npm ERR! code 1
npm ERR! Command failed: git checkout pull/236
npm ERR! error: pathspec 'pull/236' did not match any file(s) known to git

I am on a windows machine, command line.

@jorgedferreira
Copy link

Strange, I've added it that way to 3 or 4 projects now and it worked, but I'm using MacOS

@rolinger
Copy link

@AbidR-S2 - is the pull reference above the same as your fork: https://github.com/AbidR-S2/photoviewer

It installs fine with cordova plugin add but its throwing a build error:

Element uses-permission#android.permission.READ_MEDIA_IMAGES at AndroidManifest.xml:20:3-100 duplicated with element declared at AndroidManifest.xml:12:3-73

@rolinger
Copy link

Well, for now I manually edited the PhotoViewer.java file with the @AbidR-S2 changes and it worked. Not certain why I couldn't do the plugin add with the pull/236 version, but hopefully someone merges all these fixes for the future.

@jorgedferreira
Copy link

Well, it seems I was wrong in thinking this was solved. Although we are using pull/236 we tried to add a new release just now and Google Play is asking for a declaration for using the READ_MEDIA_IMAGES.

Because it's not a frequent use i doubt they will allow our usage of this plugin.

Isn't anyone else having this issue?? The deadline seemed to be today for removing the permission... We have a lot of work ahead of us to resolve this, i'm felling tired just thinking of it.

@AbidR-S2
Copy link

My company app is for commercial site inspections so in my case the use is frequent and I will be submitting a declaration. You are able to ask for an extension easily enough and they granted it right away. Right now my deadline is May 28th with the extension.

@jorgedferreira
Copy link

@AbidR-S2 Thanks for the reply. Where did you ask the extension? Was it in the declaration form they provide?

@rolinger
Copy link

rolinger commented Jan 23, 2025

I have already added all the necessary permissions to get photoviewer working in my app, and it has been submitted several times over the last 6+ months without any issue - but what is this frequent use case declaration and submitting for an extension?

I don't recall having seen this previously nor am I getting any Play Console notices about my app regarding these permissions for photoviewer. Please post link so I can look into this. Thank you.

@jorgedferreira
Copy link

@rolinger I didnt have any errors also. This started appearing yesterday and it prevents submissions to production.

It's related to: https://support.google.com/googleplay/android-developer/answer/14115180

Image

@AbidR-S2
Copy link

AbidR-S2 commented Jan 23, 2025

Its in the Policy and Programs -> App Content section of the Play Console

Clicking on learn more brings up:

Image

@jorgedferreira - I requested the extension a few months back, to be honest I can't remember where it was on the console or how you submit an extension.

@jorgedferreira
Copy link

@AbidR-S2 I submited a description of why i use the permission. I'm gonna wait to see if the app is aproved.

Either way, we will probably remove this component and use something else.

@rolinger
Copy link

Thanks guys. Turns out I answered all that previously...on Dec 21 2024 no less, but I completely forgot that I had done so. I must have had a few extra holiday eggnogs because I don't remember filling it out. Since then I have submitted 3 app updates with no issue, so I guess they have accepted my justification.

@rolinger
Copy link

@jorgedferreira - just fill it out and say your app needs it for moderate to frequent use. Its a lot easier than having to rewrite code.
Only worry about it if they still reject it after your justification submission. I doubt the really look at it that hard, more of a CYA. My app posts images ALL the time but users rarely engage the images. The difference here is that images could be clicked on (by a user) at any moment and it needs to be available in that moment, but we can't force our users to click the images.

@jorgedferreira
Copy link

jorgedferreira commented Jan 23, 2025

@rolinger Yeah, thanks, i did so. I'll be waiting for the reply...

In my case, it is used almost daily. I have a few dozens of apps for supermarkets and the offers/promotions flyers they make are huge, so users need to be able to zoom.

One thing i don't understand, all the images my users access are external to the device, they are read directly from an url... shouldn't need permissions for the phone's storage, but maybe there is a local copy made, dont know.

Edit: well, obviously its needed because of other use cases, with local access to images, etc...

@rolinger
Copy link

when the app loads the external URL it then becomes embedded in the UI for the user. To access the now embedded image it requires the phone permissions. As well, photoviewer has options that allows users to SAVE those external images to their own phone - in which case you have to have permissions. That's probably the real issue here. Because the plugin has it included in it, whether you turn on the save options or not, means Android is going to force YOU to justify it. In your declaration, let them know all images are loaded from external sources versus images that are installed with the app.

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

6 participants