I have a login module and and now I want to logout. So how can I maintain session on client side. Is there any method in worklight for this? How can I generate session id for this on client side?
please help me out.
You can use prefrence ... First save user id while login like this
prefs.edit().putString(Constants.PREF_EMAIL, userName).commit();
and when next time while launching app do this....
String email = prefs.getString(Constants.PREF_EMAIL, "guest");
String password = prefs.getString(Constants.PREF_PASSWORD, "guest");
if(!email.equalsIgnoreCase("guest") )
{
}
else
{
}
Hope this will help u...
WL.Client.Logout(realm)to logout and to get the client side session and session ID AFAIK there is no worklight javascript client side API. but you can verify by usingWL.Client.getLoginName(realm)- BluewingsWL.Client.logout("yourrealmname",{ onSuccess: successCallback, onFailure: failureCallback });you can find more in this link - Bluewings