sarriaroman / photoviewer

PhotoViewer Cordova Plugin
MIT License
155 stars 202 forks source link

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

Open vishal-revdiwala opened 1 year ago

vishal-revdiwala commented 1 year ago

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 commented 1 year ago

I've just made a new pull request to fix this issue https://github.com/sarriaroman/photoviewer/pull/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 commented 10 months ago

@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 commented 9 months ago

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 commented 7 months ago

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