I have an app that's making calls to my server.
When I press the home button and then reopen the app, I'd like it to check the server again.
I've tried the code below but the onResume
doesn't seem to even run.
// 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
}
I ended up finding success using
document.addEventListener("resume", function() {
// Action when resumed
});
and it worked perfectly!