mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-18 10:52:51 +08:00
Remove media permissions to make complaint with Android 14 requirements (#889)
Co-authored-by: Ravi Yakasiri <ravi.yakasiri@planonsoftware.com>
This commit is contained in:
parent
0a4bfe1a74
commit
faa4615ee0
@ -55,9 +55,7 @@
|
||||
</feature>
|
||||
</config-file>
|
||||
<config-file target="AndroidManifest.xml" parent="/*">
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="30" />
|
||||
</config-file>
|
||||
<config-file target="AndroidManifest.xml" parent="application">
|
||||
<provider
|
||||
|
@ -225,26 +225,11 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
||||
private String[] getPermissions(boolean storageOnly, int mediaType) {
|
||||
ArrayList<String> permissions = new ArrayList<>();
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
// Android API 33 and higher
|
||||
switch (mediaType) {
|
||||
case PICTURE:
|
||||
permissions.add(Manifest.permission.READ_MEDIA_IMAGES);
|
||||
break;
|
||||
case VIDEO:
|
||||
permissions.add(Manifest.permission.READ_MEDIA_VIDEO);
|
||||
break;
|
||||
default:
|
||||
permissions.add(Manifest.permission.READ_MEDIA_IMAGES);
|
||||
permissions.add(Manifest.permission.READ_MEDIA_VIDEO);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Android API 32 or lower
|
||||
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
|
||||
// Android API 30 or lower
|
||||
permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
}
|
||||
|
||||
if (!storageOnly) {
|
||||
// Add camera permission when not storage.
|
||||
permissions.add(Manifest.permission.CAMERA);
|
||||
|
Loading…
Reference in New Issue
Block a user