我有一个正在调用我的服务器的应用程序。
当我按下主页按钮然后重新打开应用程序时,我希望它再次检查服务器。
我试过下面的代码,但 onResume
似乎甚至没有运行。
// Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
document.addEventListener("resume", onResume, false);
}
// Handle the resume event
//
function onResume() {
// Call to the server
}
最佳答案
我最终通过使用找到了成功
document.addEventListener("resume", function() {
// Action when resumed
});
而且效果很好!
关于ios - 手机间隙 : Calling an action when an app is opened after clicking the home button (iOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27883937/