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