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)
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
Bug Report
Plugin(s)
Capacitor Version
Platform(s)
Current Behavior
The
cameraplugin requires the following permissions inAndroidManifest.xml:The
filesystemplugin requires the following permissions inAndroidManifest.xml:However, this causes problems on various Android versions:
READ_MEDIA_IMAGESpermission is not available in Android SDK versions below 33: https://developer.android.com/reference/android/Manifest.permission#READ_MEDIA_IMAGESREAD_EXTERNAL_STORAGEpermission has no effect in Android SDK versions above 32: https://developer.android.com/reference/android/Manifest.permission#READ_EXTERNAL_STORAGEWRITE_EXTERNAL_STORAGEpermission has no effect in Android SDK versions above 29: https://developer.android.com/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGEHaving 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.xmlas follows:Then the following error messages show up:
Android 12 filesystem and camera:
Android 13 filesystem:
Expected Behavior
The plugins should only require the following permissions in
AndroidManifest.xml:Code Reproduction
Other Technical Details
Additional Context