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

Deprecated WRITE_EXTERNAL_STORAGE permission required for Camera #1701

Closed
RB-Hippo opened this issue Jul 25, 2023 · 4 comments · Fixed by #1713
Closed

Deprecated WRITE_EXTERNAL_STORAGE permission required for Camera #1701

RB-Hippo opened this issue Jul 25, 2023 · 4 comments · Fixed by #1713

Comments

@RB-Hippo
Copy link

RB-Hippo commented Jul 25, 2023

Bug Report

Plugin(s)

  • capacitor/camera@5.0.6

Capacitor Version

   Capacitor Doctor

Latest Dependencies:

  @capacitor/cli: 5.2.2
  @capacitor/core: 5.2.2
  @capacitor/android: 5.2.2
  @capacitor/ios: 5.2.2

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/cli: 5.0.5
  @capacitor/android: 5.0.5
  @capacitor/core: 5.2.2

Platform(s)

  • Android 11
  • Android 12

Current Behavior

The camera plugin requires the WRITE_EXTERNAL_STORAGE permission for all Android SDK versions below 33.

However, the WRITE_EXTERNAL_STORAGE permission has no effect in Android SDK versions above 29: https://developer.android.com/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGE

Having permissions required in the manifest that are not necessary can lead to an app being rejected from Google Play.

If I implement the maximum SDK version for the permission into the AndroidManifest.xml as follows:

<!-- AndroidManifest.xml -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29" />

Then the following error message shows up when trying to use the Permission with alias CameraPlugin.PHOTOS in the Camera plugin:

File: http://localhost/vendor.js - Line 150897 - Msg: ERROR Error: Uncaught (in promise): Error: Missing the following permissions in AndroidManifest.xml:
    android.permission.WRITE_EXTERNAL_STORAGE

    Error: Missing the following permissions in AndroidManifest.xml:
    android.permission.WRITE_EXTERNAL_STORAGE

        at returnResult (http://localhost/:776:32)
        at Object.win.androidBridge.onmessage (http://localhost/:751:21)

Expected Behavior

The plugin should only require the following permissions in AndroidManifest.xml:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

Code Reproduction

https://github.com/RB-Hippo/ionic-capacitor-issue-reproduction/tree/camera-permission-issue

Other Technical Details

Additional Context

@Ionitron
Copy link
Collaborator

This issue needs more information before it can be addressed.
In particular, the reporter needs to provide a minimal sample app that demonstrates the issue.
If no sample app is provided within 15 days, the issue will be closed.

Please see the Contributing Guide for how to create a Sample App.

Thanks!
Ionitron 💙

@RB-Hippo
Copy link
Author

I have added a code reproduction and also raised PR #1702.

@ionitron-bot
Copy link

ionitron-bot bot commented Jul 28, 2023

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

@ionitron-bot
Copy link

ionitron-bot bot commented Aug 18, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Aug 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants