這是我的代碼暫停事件在PhoneGap iPhone中無法正常工作?
//This is an event that fires when a PhoneGap application is put into the background.
document.addEventListener("pause", onPause, false);
//This is an event that fires when a PhoneGap application is retrieved from the background.
document.addEventListener("resume", onResume, false);
// Handle the pause event
function onPause(){
console.log("pause : app is put into background");
}
// Handle the resume event
function onResume() {
console.log("resume : app is put into foreground");
}
當我按下home鍵沒有登錄控制檯但是當我點擊相關應用(使它在前臺),那麼我的日誌
2011-11-22 12:11:37.206 Event[644:207] [INFO] pause : app is put into background
2011-11-22 12:11:37.206 Event[644:207] [INFO] resume : app is put into foreground
我不知道爲什麼暫停函數在前臺出現時被調用。
有什麼我做錯了嗎?
我在Android上的同樣的問題。 – Toubey