I have the following code in a generic JS script:
code
var timeOut = 5 * 60 * 1000;
var onTimeout = function(){
console.log("session expired");
localStorage.setItem('CheckSessionToken', "true");
};
var onAjax = function(){
console.log("ajax clear current timer and run new");
window.clearTimeout(self.noActivityTimer);
self.noActivityTimer = window.setTimeout(onTimeout, timeOut);
};
jQuery(document).ajaxStart(onAjax)
/code
When my app (Android apk) goes into the background, the CheckSessionToken storage variable is not always set to true. Sometimes it is but most times it isn't. So my question is does the javascript timer continue to run when an android app goes to 'sleep'?
Fyi, I do have a pageshow trigger in an OnResume JS script as well, and the code in the page show checks for the value of CheckSessionToken, but I don't know if this is relevant.