Skip to content

Deprecated permissions required for Camera and Filesystem #1666

Description

@RB-Hippo

Bug Report

Plugin(s)

  • @capacitor/camera@5.0.4
  • @capacitor/filesystem@5.0.4

Capacitor Version

   Capacitor Doctor

Latest Dependencies:

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

Installed Dependencies:

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

Platform(s)

  • Android 12
  • Android 13

Current Behavior

The camera plugin requires the following permissions in AndroidManifest.xml:

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

The filesystem plugin requires the following permissions in AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

However, this causes problems on various Android versions:

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

If I implement the maximum and minimum SDK versions for the permissions into the AndroidManifest.xml as follows:

<!-- 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" android:minSdkVersion="33" />

Then the following error messages show up:
Android 12 filesystem and camera:

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)

Android 13 filesystem:

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

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

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

Expected Behavior

The plugins 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" android:minSdkVersion="33" />

Code Reproduction

<!-- 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" android:minSdkVersion="33" />

Other Technical Details

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions