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 · 9 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.

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