Refresh page when session timeout has passed

2
Hi, we're moving our project from 6 to 7. When the mobile app is resumed from the background, the page is reloaded after you click on something. So when the app is resumed back to the foreground, you first need to click on a button and then the page is reloaded (with new session etc). Expected behavior would be something like, when your app is resumed from background, then the page is reloaded only when the session timeout has passed. This means when you're still within the limits of the timeout (and you have an active session), then you can continue using the app where you left off. So I added an HTML snippet with javascript that reloads the page on resume. The good thing is that it works, but the downside is that it always works. For example when you're just switching apps, you do not want to reload the window every time.  require(["dojo/dom-attr", "dojo/on", "dojo/domReady!"], function(domAttr, on) { if (window.cordova) { function onResume() { window.mx.reload() console.log('Reload window onResume'); } document.addEventListener("resume", onResume, false); console.log('Add event listener onResume'); } }); How can I extend this snippet with checks if timeout has passed or not, or do I need another approach? Edit: The above scenario is required when you have disabled the EnableKeepAlive custom setting. I have have set EnableKeepAlive to false, because it behaves differently on iOS and Android. So I disabled it to have more control over when to reload or not. When you put your app to the background, and wait until session timeout passed. Then when you resume the app on iOS, then page is reloaded and new session is created. On Android the page is not reloaded, and you can continue where you left off. This means the keep alive keeps working on Android, even when the app is in the background or not? Anyways another approach would be to turn off these keep alive requests when app is sent to background. So the other question is: How can I turn off the keep alive requests using the html snippet?
asked
0 answers