Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/436.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript cordova 2.9摄像头插件:回调在android中不起作用_Javascript_Android_Ios_Cordova_Camera - Fatal编程技术网

Javascript cordova 2.9摄像头插件:回调在android中不起作用

Javascript cordova 2.9摄像头插件:回调在android中不起作用,javascript,android,ios,cordova,camera,Javascript,Android,Ios,Cordova,Camera,我正在使用cordova 2.9摄像头插件,代码如下: function browseFiles() { alert("browsing files... "); var options = { sourceType: Camera.PictureSourceType.PHOTOLIBRARY, quality: 45,

我正在使用cordova 2.9摄像头插件,代码如下:

function browseFiles() {
                    alert("browsing files... ");
                    var options = {
                        sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
                        quality: 45, // previously 50.  Stay below 50 per Phonegap doc about IOS memory issues
                        destinationType: Camera.DestinationType.DATA_URL,
                        //encodingType: Camera.EncodingType.JPEG,
                        //saveToPhotoAlbum: true,
                        correctOrientation: true,
                        // I get OutOfMemoryError on Samsung Galaxy S3 (and other Android) if I don't specify size.
                        // see thread:  https://groups.google.com/forum/?fromgroups=#!topic/phonegap/YWZlnFUfRjE
                        targetWidth: 400,
                        targetHeight: 400
                    };
                    NativeBridge.captureImage(function (_data) {
                        //alert("data: " + _data);
                        $("#MyImage").attr('src', "data:image/jpeg;base64," + _data);
                        $("#MyImage").attr('data-base64', _data);
                    }, undefined, options);
                };

captureImage: function (cameraSuccess, cameraError,customOptions) {




            if (!cameraError) {
                cameraError = function (message) {
                    NativeBridge.alert('Failed because: ' + message);
                }
            }
            if (JSContext.getIsWebApp() == true) {
                WebApp.captureImage(cameraSuccess, cameraError, customOptions);
            }
            else {
                if (navigator.camera && navigator.camera.getPicture) {
                    try {
                        var options = {};

                        if (customOptions) {
                            options = customOptions;
                        } else {
                            options = {
                                sourceType: Camera.PictureSourceType.CAMERA,
                                quality: 45, // previously 50.  Stay below 50 per Phonegap doc about IOS memory issues
                                destinationType: Camera.DestinationType.DATA_URL,
                                //encodingType: Camera.EncodingType.JPEG,
                                //saveToPhotoAlbum: true,
                                correctOrientation: true,
                                // I get OutOfMemoryError on Samsung Galaxy S3 (and other Android) if I don't specify size.
                                // see thread:  https://groups.google.com/forum/?fromgroups=#!topic/phonegap/YWZlnFUfRjE
                                targetWidth: 400,
                                targetHeight: 400
                            };
                        }
                        // Old Options {quality: 50,destinationType: Camera.DestinationType.DATA_URL }
                        navigator.camera.getPicture(cameraSuccess, cameraError, options);
                    }
                    catch (err) {
                        cameraError(err);
                    }
                }
                else {
                    NativeBridge.alert("Camera is not supported");
                }

            }
        }

    }
但在任何android设备上都不会调用回调。 在iPhone上,它工作正常,我调试了应用程序,这是logcat中的内容:

06-26 16:34:47.417: W/IInputConnectionWrapper(27159): showStatusIcon on inactive InputConnection
    1:35 PM
    06-26 16:35:07.792: I/Info(27159): width : 1280
    1:35 PM
    06-26 16:35:07.792: I/Info(27159): height : 720
    1:35 PM
    06-26 16:35:07.822: D/WebView(27159): loadUrlImpl: called
    1:35 PM
    06-26 16:35:07.822: D/webcore(27159): CORE loadUrl: called
    1:36 PM
    06-26 16:35:07.872: V/CustomViewBehind(27159): behind INVISIBLE
    1:36 PM
    06-26 16:35:08.227: I/Info(27159): width : 720
    1:36 PM
    06-26 16:35:08.227: I/Info(27159): height : 1280
    1:36 PM
    06-26 16:35:08.337: I/System.out(27159): Not a DRM File, opening notmally
    1:36 PM
    06-26 16:35:08.337: I/System.out(27159): buffer returned 
    1:36 PM
    06-26 16:35:08.342: V/CustomViewBehind(27159): behind INVISIBLE
    1:36 PM

非常感谢您提供的任何帮助

请检查此项以及此项我正在寻找与cordova相关的问题