使用cordova打包sencha touch做的项目,使用cordova中的navigator.notification.confirm弹出提示无效

EE___ 2014-08-07 04:26:21
使用的是cordova 2.6 版本
在app.js文件下

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", onBackButton, false);
}
function onBackButton() {
if(Ext.os.is('Android')) {
var id = Ext.Viewport.getActiveItem().getActiveItem().id;
if(id.indexOf('userview') != -1) {
alert('exit');
navigator.notification.confirm(
'您确定要退出应用吗?', // message
function(buttonIndex){
if(buttonIndex == 2){
navigator.app.exitApp();
}
}, // callback to invoke with index of button pressed
'提示', // title
'取消,确定' // buttonLabels
);
}
}
}

在首页点击手机上的返回按钮,alert('exit');会弹出来,但是后面的代码无效。
config.xml 中已加入: <plugin name="Notification" value="org.apache.cordova.Notification"/>
AndroidManifest.xml中已加入:<uses-permission android:name="android.permission.VIBRATE" />
...全文
773 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Desaut 2015-04-28
  • 打赏
  • 举报
回复
我在PhoneGap Developer App上调试好好的。打包apk安装就失效了
Desaut 2015-04-28
  • 打赏
  • 举报
回复
楼主后来解决了没有。一模一样的问题

39,082

社区成员

发帖
与我相关
我的任务
社区描述
HTML5是构建Web内容的一种语言描述方式。HTML5是互联网的下一代标准,是构建以及呈现互联网内容的一种语言方式.被认为是互联网的核心技术之一。
社区管理员
  • HTML5社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧