Phonegap事件之resume事件

Phonegap事件之resume事件

当 应用重新从后台恢复到前台时    事件触发

类似android 中activity生命周期里的 resume

 

支持平台:

Amazon Fire OS Android BlackBerry 10 iOS Windows Phone 7 and 8 Windows 8

 

简单例子:

document.addEventListener("resume", onResume, false);
function onResume() {    
// Handle the resume event

}


 

完整例子:


  
    
Resume Example    
    
  
	 	   
	 	   


 

 

IOS 遇到的问题:

当调用resume 事件处理时 

互动功能如alert()需要包裹在 setTimeout()()  里面

调用的超时时间值为零,否则应用程序挂起。例如:

document.addEventListener("resume", onResume, false);
function onResume() {   
setTimeout(function() {          
// TODO: do your thing!        
}, 0);
}


 

 

 

 

 

 

你可能感兴趣的:(phonegap,phonegap)