PhoneGap构建与Android相机不发射 [英] PhoneGap Build with Android Camera not firing

查看:103
本文介绍了PhoneGap构建与Android相机不发射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让相机工作使用phonegap build(我很新的这个)。

I am trying to get the camera working using phonegap build (I am very new to this). The problem is that nothing seems to be firing.

我的代码:

$(document).on('click', '.add_photo', function(){
    document.addEventListener('deviceready', onDeviceReady, false);
    function onDeviceReady(){
            navigator.camera.getPicture(onSuccess, onFail, {quality:50});
            function onSuccess(imageData){
                var image=document.getElementById('myImage');
                image.src='data:image/jpeg;base64,'+imageData;
            }
            function onFail(message){
                alert(message);
            }
    }
});

这已从Phoegap API页面修改。

This has been modified from the Phoegap API pages.

config.xml 包括以下行:

<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="http://api.phonegap.com/1.0/file" />


推荐答案

您是否提供了指向cordova.js的链接?如果你使用phonegap build,你不需要在你的项目中有cordova文件,只需在你的头添加以下脚本标签:

Have you included a link to the cordova.js? If you are using phonegap build you don't need to have the cordova file in your project, just add the following script tag to your header:

<script src="cordova.js"></script>

phonegap构建服务会为您自动添加文件。

The phonegap build service adds the file automatically for you.

这篇关于PhoneGap构建与Android相机不发射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆