用户友好提醒,支持多种方式
牛刀小试
本地通知提醒(定时清除)
本地通知提醒
alert提醒
hint提醒
confirm提醒
vibrate震动提醒
打开进度条提醒
示例代码
//本地通知notification。
//title:本地通知的名字;
//body:本地通知的内容;
//isAutoDisappear:是否设置自动清除,false为手动清除;
//disappearTime:若为自动清除,设置自动清除的时间,单位ms;
//clickAction:点击通知后返回到activity所执行的js方法名;
//clickActionParams:方法的参数,json格式;
$("#btnNotification").tap(function() {
var params = {
"title":"BingoTouch",
"body":"感谢使用BingoTouch!",
"isAutoDisappear":true,
"disappearTime":5000,
"clickAction": "afterNotification",
"clickActionParams": {"title":"再次感谢使用BingoTouch!"}
};
app.notification.notify(params);
});
afterNotification = function(param){
alert(param.title);
}
//alert提醒
$("#btnAlert").tap(function() {
app.alert("这是一个定制的提示框", function() {
}, "温馨提示", "OK");
});
//hint提醒
$("#btnHint").tap(function() {
app.hint("hello,bingotouch");
});
//confirm提醒
$("#btnConfirm").tap(function() {
app.confirm("确定要使用BingoTouch吗?", function(index) {
if (index == 1) {
app.hint("我点击了取消");
} else {
app.hint("我点击了确定");
}
}, "请您确认", "取消,确认");
});
//Vibrate提醒
$("#btnVibrate").tap(function() {
app.vibrate(2000);
});
//btnStartProgress进度条提醒
$("#btnStartProgress").tap(function() {
app.progress.start("进度条", "等待三秒后执行stop方法");
setTimeout("app.progress.stop()", 3000);
});