I've got an app running jQuery 1.9.1, jQuery Mobile 1.4.2 and Phonegap 3.4.0.

It has a login screen so that when you first open the app, you input your info, it does an AJAX check and if all is well, stores your info and moves you past that page.

The ideal scenario, is that everytime the app is sent to the background (the user goes home or switches apps), and then restarts the app they have to login again.

Currently I am accomplishing this in iOS by setting the

<preference name="exit-on-suspend" value="true" />

preference in my config.xml. I am accomplishing the same thing in Android by using navigator.app.exitApp(); in a pause event listener.

This works well enough usually, but some older versions of android have a weird problem. While going home and restarting the app bring you to the login page, you can just hit the back button and it takes you to the last page you were on before you quit, and you are still logged in. I also have a function that destroys all user variables (rendering all pages useless) when the app pauses, but that also seems to be ignored. On older versions of Android (2.3 specifically), it seems that they are ignoring the pause event listener.

How do I fix that, or is there an all around better way of forcing login on restart?

Related posts

Recent Viewed