[ 
https://issues.apache.org/jira/browse/CB-10670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15212684#comment-15212684
 ] 

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

GitHub user riknoll opened a pull request:

    https://github.com/apache/cordova-plugin-media-capture/pull/59

    Removing global state and fixing CB-10670

    There are two parts to this PR.
    
    The first is to fix Marshmallow permissions (CB-10670). `captureImage()` 
was not requesting `READ_EXTERNAL_STORAGE` and both `captureImage()` and 
`captureVideo()` needed the fix that was recently done in the camera plugin for 
the `CAMERA` permission 
(https://github.com/apache/cordova-plugin-camera/pull/179).
    
    The second was to remove the global state being maintained in the plugin. 
This caused a lot of issues when async calls to the plugin overlap. It is 
included in this PR because most of them are related to async Android calls 
like requesting permissions and launching external Activities (see also 
https://github.com/apache/cordova-android/pull/285). I'm planning on doing a 
similar fix for the file plugin soon.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MSOpenTech/cordova-plugin-media-capture 
CB-10670refactor

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-media-capture/pull/59.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #59
    
----
commit 3f1e3366daf2fe9cb4c4195468a27eee5714bd98
Author: Richard Knoll <richard.b.kn...@gmail.com>
Date:   2016-03-21T22:21:30Z

    CB-10670 android: Fixing Marshmallow permissions for image and video capture

commit 6511db0af87806ad32abdcacfcb78619c60a8d6d
Author: Richard Knoll <richard.b.kn...@gmail.com>
Date:   2016-03-23T18:28:58Z

    Refactor and fixing support for multiple Activity Requests

commit df0f9a66ac9393745d8d9dad927548504368c725
Author: Richard Knoll <richard.b.kn...@gmail.com>
Date:   2016-03-26T00:51:01Z

    Documenting capture error

----


> Media Capture on Android 6.0.1 fails
> ------------------------------------
>
>                 Key: CB-10670
>                 URL: https://issues.apache.org/jira/browse/CB-10670
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Media Capture
>    Affects Versions: 5.1.0
>            Reporter: Christoph Brosdau
>            Assignee: Richard B Knoll
>            Priority: Critical
>              Labels: Android, triaged
>
> Although this should work, I cannot make it work - on android 6.0, i always 
> have the same issue concerning permissions - maybe I overlooked something, 
> but I dont know what :)
> Whith the following super simple demo JS and latest Cordova and latest 
> version of all plugins, I get:
> navigator.device.capture.captureVideo(function(){},function(e){console.log(e);},{limit:1});
> In the console, I get:
> Permission Denial: starting Intent { act=android.media.action.VIDEO_CAPTURE 
> cmp=com.google.android.GoogleCamera/com.android.camera.VideoCamera (has 
> extras) } from ProcessRecord{7481fe2 17042:tv.nexx.android.gdtv/u0a183} 
> (pid=17042, uid=10183) with revoked permission android.permission.CAMERA
> In Android Studio I get:
> Uncaught exception from plugin
>                                                                      
> java.lang.SecurityException: Permission Denial: starting Intent { 
> act=android.media.action.IMAGE_CAPTURE flg=0x3 
> cmp=com.google.android.GoogleCamera/com.android.camera.CaptureActivity 
> clip={text/uri-list 
> U:file:///storage/emulated/0/Android/data/tv.nexx.android.gdtv/cache/.Pic.jpg}
>  (has extras) } from ProcessRecord{7481fe2 17042:tv.nexx.android.gdtv/u0a183} 
> (pid=17042, uid=10183) with revoked permission android.permission.CAMERA
>                                                                          at 
> android.os.Parcel.readException(Parcel.java:1620)
>                                                                          at 
> android.os.Parcel.readException(Parcel.java:1573)
>                                                                          at 
> android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2658)
>                                                                          at 
> android.app.Instrumentation.execStartActivity(Instrumentation.java:1507)
>                                                                          at 
> android.app.Activity.startActivityForResult(Activity.java:3930)
>                                                                          at 
> org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:332)
>                                                                          at 
> android.app.Activity.startActivityForResult(Activity.java:3890)
>                                                                          at 
> org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:65)
>                                                                          at 
> org.apache.cordova.camera.CameraLauncher.takePicture(CameraLauncher.java:262)
>                                                                          at 
> org.apache.cordova.camera.CameraLauncher.callTakePicture(CameraLauncher.java:236)
>                                                                          at 
> org.apache.cordova.camera.CameraLauncher.execute(CameraLauncher.java:168)
>                                                                          at 
> org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
>                                                                          at 
> org.apache.cordova.PluginManager.exec(PluginManager.java:133)
>                                                                          at 
> org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
>                                                                          at 
> org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
>                                                                          at 
> org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
>                                                                          at 
> org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:37)
>                                                                          at 
> android.os.Handler.dispatchMessage(Handler.java:102)
>                                                                          at 
> android.os.Looper.loop(Looper.java:148)
>                                                                          at 
> android.os.HandlerThread.run(HandlerThread.java:61)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to