从 PhotoLibrary 获取图像时,Cordova 应用程序导航到主屏幕

Cordova app navigates to home screen when fetching image from PhotoLibrary

用例:从图库中选择图片并执行回调

问题:从图库中选择图像后重定向到应用程序的主屏幕。

从相机获取图像有效:

navigator.camera.getPicture(function() {
    console.log('success'); 
},function() {
    console.log('failure'); 
} , {
    destinationType: Camera.DestinationType.DATA_URL
});

从图库中选择图像重定向到主屏幕

navigator.camera.getPicture(function() {
    console.log('success'); 
},function() {
    console.log('failure'); 
} , {
    destinationType: navigator.camera.DestinationType.FILE_URI,
    sourceType: navigator.camera.PictureSourceType.SAVEDPHOTOALBUM
});

代码相当简单,在很多地方都提到了如何从图库中选择图像的示例。此代码不适用于 App 主屏幕以外的任何屏幕。另外,重定向前不报错。

以下代码还会导致在选择图像后重定向到主屏幕。

<input type="file" name="">

配置:

Device: Windows Lumia 535
Device OS Version: 8.1
Cordova: 6.1.1 
Cordova plugin camera: 2.2.0

无法停止页面导航,除非在应用程序的第一页(没有查询参数)。后来改成单页应用,避免了这个问题。

可以在 https://issues.apache.org/jira/browse/CB-11295

跟踪问题