[
https://issues.apache.org/jira/browse/CB-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289765#comment-13289765
]
Tim Kim commented on CB-621:
----------------------------
It appears that this issue is due to a bug in webworks:
https://github.com/blackberry/WebWorks-TabletOS/issues/51
Recently, Gord Tanner made a fix:
https://github.com/gtanner/incubator-cordova-js/commit/50ad576ab21a89084d8609a8b4d41f55070a94ca
Will test and report back.
> camera.getPicture() calls both the success and error callbacks when a picture
> is taken.
> ---------------------------------------------------------------------------------------
>
> Key: CB-621
> URL: https://issues.apache.org/jira/browse/CB-621
> Project: Apache Cordova
> Issue Type: Bug
> Components: BlackBerry
> Affects Versions: 1.4.0, 1.7.0
> Environment: BlackBerry PlayBook v2.0.
> Reporter: Wayne Fisher
> Fix For: 1.9.0
>
>
> Testing on a 2.0 Playbook, I saw both of my callbacks (success and error)
> called when a picture was successfully taken and returned to my app.
> The problem appears to be here:
> {code}
> cameraAPI = {
> execute: function (webWorksResult, action, args, win, fail) {
> if (action === 'takePicture') {
> blackberry.media.camera.takePicture(win, fail, fail);
> return retAsyncCall();
> }
> else {
> return retInvalidAction();
> }
> }
> },
> {code}
> The second parameter to WebWorks takePicture() is defined to be
> "onCameraClosed". It appears that onCameraClosed is called after the
> onCaptured (the first parameter) callback is called.
> I was able to achieve the documented behaviour for camera.getPicture() by
> modifying the above code to the following:
> {code}
> cameraAPI = {
> execute: function (webWorksResult, action, args, win, fail) {
> var pictureTaken = false;
> if (action === 'takePicture') {
> function success( picture ) {
> pictureTaken = true;
> win( picture );
> }
> function cameraClose() {
> if( !pictureTaken ) {
> fail( "User canceled operation." );
> }
> }
> blackberry.media.camera.takePicture(success, cameraClose,
> fail);
> return retAsyncCall();
> }
> else {
> return retInvalidAction();
> }
> }
> },
> {code}
> I would expect that this issue also affects the use of the takePicture method
> as used in the Media APIs.
> I tested with PhoneGap v1.4.0. The code example from above is from v1.7.0rc1
> which is implemented virtually the same as v1.4.0.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira