科尔多瓦应用程序从捕获或照片库获取图片后重新启动



我正在尝试使用jquery Mobile和php在我的服务器上添加图片,用于Android的Cordova项目。

当我从图书馆中选择图片或进行捕获时,应用程序会重新启动,而不是用图片刷新我的表单。

这是我的HTML代码:

<button onclick="capturePhoto();">Capture Photo</button>
<button onclick="getPhoto(pictureSource.PHOTOLIBRARY);">From Photo Library</button>

这是我的jquery移动代码:

function capturePhoto() {
    navigator.camera.getPicture(onPhotoDataSuccess, onFail, {
        quality: 50,
        targetWidth: 600,
        targetHeight: 600,
        destinationType: destinationType.FILE_URI,
        encodingType:navigator.camera.EncodingType.JPEG,
        saveToPhotoAlbum: true
    });
}
function getPhoto(source) {
    navigator.camera.getPicture(onPhotoURISuccess, onFail, {
        quality: 50,
        targetWidth: 600,
        targetHeight: 600,
        destinationType: destinationType.FILE_URI,
        encodingType:navigator.camera.EncodingType.JPEG,
        sourceType: source
    });
}

我到处搜索过,但找不到任何解决方案。

编辑,我有最新版本的科尔多瓦和最后一个文件插件

幸运的是,为了以防万一,我尝试更改 html 代码,这是解决方案:

我只是更改此代码:

<button onclick="capturePhoto();">Capture Photo</button>

对此:

<a href="" class="ui-btn" onclick="capturePhoto();">Capture Photo</a>

不要使用 html 按钮标签,使用锚标签...不知道为什么,但这!!

最新更新