You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Rubén Panadero (JIRA)" <ji...@apache.org> on 2018/01/15 12:04:00 UTC
[jira] [Updated] (CB-13781) Error requesting permission on Android
8 - Save on photo album issue
[ https://issues.apache.org/jira/browse/CB-13781?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rubén Panadero updated CB-13781:
--------------------------------
Description:
Google has changed how an android application must request permissions on Android 8. In fact, it is considered as fix by Google due to a wrong behavior on previous versions.
Related documentation:
[https://developer.android.com/about/versions/oreo/android-8.0-changes.html#rmp]
This change made by Google has affected the cordova-camera-plugin. To save a photo in Photo Album, the plugin just requests the READ_EXTERNAL_STORAGE permission right now, but that is not enough on Android 8 because the plugin writes the photo file into Pictures folder so it has to request the writing permission, which is missing, as well.
This is the error that the plugin throws when a photo is tried to be saved into the photo album on Android 8.
> 01-12 11:38:16.757 W/System.err(22321): java.io.FileNotFoundException: open failed: EACCES (Permission denied)
> 01-12 11:38:16.758 W/System.err(22321): at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:313)
> 01-12 11:38:16.758 W/System.err(22321): at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:211)
> 01-12 11:38:16.758 W/System.err(22321): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1242)
> 01-12 11:38:16.758 W/System.err(22321): at android.content.ContentResolver.openOutputStream(ContentResolver.java:1007)
> 01-12 11:38:16.758 W/System.err(22321): at android.content.ContentResolver.openOutputStream(ContentResolver.java:983)
> 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.camera.CameraLauncher.writeUncompressedImage(CameraLauncher.java:979)
> 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.camera.CameraLauncher.writeUncompressedImage(CameraLauncher.java:1015)
> 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.camera.CameraLauncher.processResultFromCamera(CameraLauncher.java:603)
> 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.camera.CameraLauncher.onActivityResult(CameraLauncher.java:919)
> 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:152)
> 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:358)
> 01-12 11:38:16.758 W/System.err(22321): at android.app.Activity.dispatchActivityResult(Activity.java:7235)
> 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread.deliverResults(ActivityThread.java:4336)
> 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4383)
> 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread.-wrap19(Unknown Source:0)
> 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1652)
> 01-12 11:38:16.758 W/System.err(22321): at android.os.Handler.dispatchMessage(Handler.java:105)
> 01-12 11:38:16.758 W/System.err(22321): at android.os.Looper.loop(Looper.java:164)
> 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread.main(ActivityThread.java:6600)
> 01-12 11:38:16.758 W/System.err(22321): at java.lang.reflect.Method.invoke(Native Method)
> 01-12 11:38:16.758 W/System.err(22321): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
> 01-12 11:38:16.758 W/System.err(22321): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:772)
To sum up, if the plugin has to save a photo in the photo album, this one has to request both READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
was:
Google has changed how an android application must request permissions on Android 8. In fact, it is considered as fix by Google due to a wrong behavior on previous versions.
Related documentation:
https://developer.android.com/about/versions/oreo/android-8.0-changes.html#rmp
This change made by Google has affected the cordova-camera-plugin. To save a photo in Photo Album, the plugin just requests the READ_EXTERNAL_STORAGE permission right now, but that is not enough on Android 8 because the plugin writes the photo file into Pictures folder so it has to request the writing permission, which is missing, as well.
To sum up, if the plugin has to save a photo in the photo album, this one has to request both READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
> Error requesting permission on Android 8 - Save on photo album issue
> --------------------------------------------------------------------
>
> Key: CB-13781
> URL: https://issues.apache.org/jira/browse/CB-13781
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-plugin-camera
> Reporter: Rubén Panadero
> Priority: Critical
>
> Google has changed how an android application must request permissions on Android 8. In fact, it is considered as fix by Google due to a wrong behavior on previous versions.
> Related documentation:
> [https://developer.android.com/about/versions/oreo/android-8.0-changes.html#rmp]
> This change made by Google has affected the cordova-camera-plugin. To save a photo in Photo Album, the plugin just requests the READ_EXTERNAL_STORAGE permission right now, but that is not enough on Android 8 because the plugin writes the photo file into Pictures folder so it has to request the writing permission, which is missing, as well.
> This is the error that the plugin throws when a photo is tried to be saved into the photo album on Android 8.
> > 01-12 11:38:16.757 W/System.err(22321): java.io.FileNotFoundException: open failed: EACCES (Permission denied)
> > 01-12 11:38:16.758 W/System.err(22321): at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:313)
> > 01-12 11:38:16.758 W/System.err(22321): at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:211)
> > 01-12 11:38:16.758 W/System.err(22321): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1242)
> > 01-12 11:38:16.758 W/System.err(22321): at android.content.ContentResolver.openOutputStream(ContentResolver.java:1007)
> > 01-12 11:38:16.758 W/System.err(22321): at android.content.ContentResolver.openOutputStream(ContentResolver.java:983)
> > 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.camera.CameraLauncher.writeUncompressedImage(CameraLauncher.java:979)
> > 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.camera.CameraLauncher.writeUncompressedImage(CameraLauncher.java:1015)
> > 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.camera.CameraLauncher.processResultFromCamera(CameraLauncher.java:603)
> > 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.camera.CameraLauncher.onActivityResult(CameraLauncher.java:919)
> > 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:152)
> > 01-12 11:38:16.758 W/System.err(22321): at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:358)
> > 01-12 11:38:16.758 W/System.err(22321): at android.app.Activity.dispatchActivityResult(Activity.java:7235)
> > 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread.deliverResults(ActivityThread.java:4336)
> > 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread.handleSendResult(ActivityThread.java:4383)
> > 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread.-wrap19(Unknown Source:0)
> > 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1652)
> > 01-12 11:38:16.758 W/System.err(22321): at android.os.Handler.dispatchMessage(Handler.java:105)
> > 01-12 11:38:16.758 W/System.err(22321): at android.os.Looper.loop(Looper.java:164)
> > 01-12 11:38:16.758 W/System.err(22321): at android.app.ActivityThread.main(ActivityThread.java:6600)
> > 01-12 11:38:16.758 W/System.err(22321): at java.lang.reflect.Method.invoke(Native Method)
> > 01-12 11:38:16.758 W/System.err(22321): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
> > 01-12 11:38:16.758 W/System.err(22321): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:772)
> To sum up, if the plugin has to save a photo in the photo album, this one has to request both READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org