mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-18 19:22: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>
|
</feature>
|
||||||
</config-file>
|
</config-file>
|
||||||
<config-file target="AndroidManifest.xml" parent="/*">
|
<config-file target="AndroidManifest.xml" parent="/*">
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="30" />
|
||||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
|
||||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
|
||||||
</config-file>
|
</config-file>
|
||||||
<config-file target="AndroidManifest.xml" parent="application">
|
<config-file target="AndroidManifest.xml" parent="application">
|
||||||
<provider
|
<provider
|
||||||
|
@ -225,26 +225,11 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
|||||||
private String[] getPermissions(boolean storageOnly, int mediaType) {
|
private String[] getPermissions(boolean storageOnly, int mediaType) {
|
||||||
ArrayList<String> permissions = new ArrayList<>();
|
ArrayList<String> permissions = new ArrayList<>();
|
||||||
|
|
||||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
|
||||||
// Android API 33 and higher
|
// Android API 30 or lower
|
||||||
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
|
|
||||||
permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
permissions.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||||
permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
permissions.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!storageOnly) {
|
if (!storageOnly) {
|
||||||
// Add camera permission when not storage.
|
// Add camera permission when not storage.
|
||||||
permissions.add(Manifest.permission.CAMERA);
|
permissions.add(Manifest.permission.CAMERA);
|
||||||
|
Loading…
Reference in New Issue
Block a user