How To maintain session in phoneGap
You can make use of localStorage, as Nurdin said its not that persistent.
Read more about it here. http://www.w3schools.com/html/html5_webstorage.asp
so you must put a condition to check if the user is logged in or not before login page, ie
if(window.localStorage.getItem("loggedIn") == 1) {
// Logged In
// Redirect to first page after logged in.
}
else
{
// Redirect to login page.
}
In login page, after the login success.
window.localStorage.setItem("loggedIn", 1);
window.localStorage.setItem("username", document.getElementsByName("usernametextbox").value);
etc..
In logout page clear this localStorage value.
window.localStorage.removeItem("loggedIn");
window.localStorage.removeItem("username");