0
有没有简单的方法让第一次应用程序显示和有更新时有人点击接受?PhoneGap应用程序接受条款和条件?
有没有简单的方法让第一次应用程序显示和有更新时有人点击接受?PhoneGap应用程序接受条款和条件?
您可以使用下面逻辑
在您的index.html添加下面的脚本
var version = "2.0"
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
var current_version = window.localStorage.getItem("version");
if(current_version != version){
navigator.notification.confirm(
'Please accept terms and conditions',
onConfirm,
'T&C',
'Ok, Cancel'
);
}
}
function onConfirm(button) {
if(button == 'Ok'){ } else {}
}
你可以设置一个localStorage的项目是开放的检查,看它是否已被接受,也可能是版本号,以便每次更新推你的逻辑时说像
if(localStorage.getItem(version) == "1.0){
console.log("already set");
}
else {
console.log("need to accept");
// fire alert or confirmation box once complete set version to 1.0
}
我给这个一杆。谢谢! – jasonflaherty 2012-03-06 23:39:33