SecurityException when accessing images with File Plug-in on Android 4.4 or higher

Asked 2 years ago, Updated 2 years ago, 86 views

My name is Takahashi.

I am developing at monaca.
The following symptoms occur on Android 4.4 and later devices:

Start the gallery from within the app with the Camera plug-in getPicture().
When you select an image from internal storage (vertical to the left) and try to get the image size
SecurityException occurs.

E/DatabaseUtils(16641):java.lang.SecurityException:Permission Denial:reading com.android.externalStorage.ExternalStorageProvider uri content://com.android.externalStorage.documents/documents/9C33-6BBD:Download/froid.android=10821=
E/DatabaseUtils (16641): at android.content.ContentProvider.enforceReadPermissionInner (ContentProvider.java:467)
E/DatabaseUtils (16641): at android.content.contentProvider $Transport.enforceReadPermission (ContProvider.java:394)
E/DatabaseUtils (16641): at android.content.ContentProvider $Transport.enforceFilePermission (ContentProvider.java:387)
E/DatabaseUtils (16641): at android.content.contentProvider$Transport.openTypeAssetFile(ContProvider.java:339)
E/DatabaseUtils (16641): at android.content.ContentProviderNative.onTransact (ContentProviderNative.java:316)
E/DatabaseUtils (16641): at android.os.Binder.execTransact (Binder.java:404)
E/DatabaseUtils (16641): at dalvik.system.NativeStart.run (Native Method)

Please let me know if you have any countermeasures.

By the way, the above phenomenon does not occur when using QuickPik or another gallery app.

I look forward to your kind cooperation.

monaca

2022-09-30 20:50

2 Answers

Try adding android.permission.MANAGE_DOCUMENTS to uses-permission in Android Manifest as indicated in the error message.


2022-09-30 20:50

http://blog.kotemaru.org/2014/11/23/android-choose-picture.html
It may be the same symptom.
Take a look.


2022-09-30 20:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.