[英]How does camera.getPicture works in android using apache cordova?
使用apache cordova插件,我可以打开相机功能,但是当我拍照时,应用程序将重新启动。
navigator.camera.getPicture( cameraSuccess, cameraError, cameraOptions );
i also had a same problem.but, finally i get the solution for camera plugin. 我也有同样的问题。但是,最后我得到了相机插件的解决方案。 and my code is below. 而我的代码如下。
$(document).on('click','.capture_photo',function(){
navigator.camera.getPicture(onPhotoDataSuccess, onFail, {
quality : 75,
destinationType : Camera.DestinationType.DATA_URL,
sourceType : Camera.PictureSourceType.CAMERA,
encodingType: Camera.EncodingType.PNG,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
});
});
// to call the success function of capture image(onPhotoDataSuccess)
function onPhotoDataSuccess(imageData) {
sessionStorage.setItem("img_api",imageData);
$('#captureimg').attr('src','data:image/jpeg;base64,' + imageData);
App.show_toast("Profile image updated successfully!");
}
Hope, it will usefull 希望它会有用
Finally I resolved it... 终于我解决了...
we need to add below two lines in config.xml.
我们需要在config.xml.
添加以下两行config.xml.
<preference name="KeepRunning" value="true" />
<preference name="exit-on-suspend" value="false" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.