Anand Anand - 1 year ago 175
Android Question

Expire login session after some time in android

I need to implement auto log out functionality in my android application , no matter which screen is showing currently.

Thanks in advance!

Answer Source

Just set one alarm manager after login then whenever that alarm will trigger then call one broadcast reciver and in that broadcast just write code for log out and clear all session value which related to that login

u can restart your app like this and from this all previews activity all top will be also clear

Intent i = cntxt.getPackageManager().getLaunchIntentForPackage(cntxt.getPackageName() );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download