christiaan commented on PR #844:
URL: 
https://github.com/apache/cordova-plugin-camera/pull/844#issuecomment-1689816971

   On an Android 8.0 device it fails after it asks for permission the first 
time with the following error
   
   ```
   FATAL EXCEPTION: main
   Process: com.myapp.app, PID: 22690
   java.lang.RuntimeException: Failure delivering result 
ResultInfo{who=@android:requestPermissions:, request=1, result=-1, data=Intent 
{ act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity 
{com.myapp.app/com.myapp.app.MainActivity}: java.lang.SecurityException: 
Permission Denial: reading com.android.providers.media.MediaProvider uri 
content://media/external/images/media from pid=22690, uid=10176 requires 
android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
       at android.app.ActivityThread.deliverResults(ActivityThread.java:4491)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:4534)
       at android.app.ActivityThread.-wrap20(Unknown Source:0)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1752)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6944)
       at java.lang.reflect.Method.invoke(Native Method)
       at 
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
   Caused by: java.lang.SecurityException: Permission Denial: reading 
com.android.providers.media.MediaProvider uri 
content://media/external/images/media from pid=22690, uid=10176 requires 
android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
       at android.os.Parcel.readException(Parcel.java:1967)
       at 
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
       at 
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
       at 
android.content.ContentProviderProxy.query(ContentProviderNative.java:418)
       at android.content.ContentResolver.query(ContentResolver.java:760)
       at android.content.ContentResolver.query(ContentResolver.java:710)
       at android.content.ContentResolver.query(ContentResolver.java:668)
       at 
org.apache.cordova.camera.CameraLauncher.queryImgDB(CameraLauncher.java:1222)
       at 
org.apache.cordova.camera.CameraLauncher.takePicture(CameraLauncher.java:325)
       at 
org.apache.cordova.camera.CameraLauncher.onRequestPermissionResult(CameraLauncher.java:1362)
       at 
org.apache.cordova.CordovaInterfaceImpl.onRequestPermissionResult(CordovaInterfaceImpl.java:222)
       at 
org.apache.cordova.CordovaActivity.onRequestPermissionsResult(CordovaActivity.java:527)
       at 
android.app.Activity.dispatchRequestPermissionsResult(Activity.java:7780)
       at android.app.Activity.dispatchActivityResult(Activity.java:7603)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:4487)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:4534) 
       at android.app.ActivityThread.-wrap20(Unknown Source:0) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1752) 
       at android.os.Handler.dispatchMessage(Handler.java:105) 
       at android.os.Looper.loop(Looper.java:164) 
       at android.app.ActivityThread.main(ActivityThread.java:6944) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at 
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 
   ```
   
   If I then choose to pick a picture using using 
`Camera.PictureSourceType.PHOTOLIBRARY` it requests permission for storage and 
after that the `Camera.PictureSourceType.CAMERA` also works again.
   
   I am calling `getPicture` like so
   ```
   navigator.camera.getPicture(this.onCameraSuccess.bind(this), 
this.onCameraError.bind(this), {
       quality: 50,
       destinationType: Camera.DestinationType.DATA_URL,
       sourceType: Camera.PictureSourceType.CAMERA,
       allowEdit: false,
       encodingType: Camera.EncodingType.JPEG,
       correctOrientation: true,
       targetWidth: 1024,
       targetHeight: 1024
   });
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to