You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/01/15 12:15:04 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16326177#comment-16326177 ] 

ASF GitHub Bot commented on CB-13781:
-------------------------------------

rpanadero opened a new pull request #308: CB-13781: (android) Fixed permissions request on Android 8 to save a …
URL: https://github.com/apache/cordova-plugin-camera/pull/308
 
 
   …photo into the photo album
   
   ### Platforms affected
   Android
   
   ### What does this PR do?
   It fixes a issue managing permissions when a photo wants to be saved into the photo album.
   
   The plugin is requesting both WRITE and READ permissions, if they are not accepted yet, before taking a photo by the device camera. 
   
   ### What testing has been done on this change?
   The changed has been tested on multiple Android devices both with Android 8 and with Android 7-.
   As for example
   
   ### Checklist
   - [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
   - [X] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
   - [X ] Added automated test coverage as appropriate for this change.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> 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