Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save user log-in state in Android?

I'm trying to build an app with a login module. I want to save the user login state so that the end-user will not have to retype his/her credentials except if they have explicitly logged out.

I understand that SharedPreferences can be of some use but I would appreciate it if some one can provide me some of their expert insight in this matter.

like image 200
Ahmed Avatar asked Jul 29 '11 16:07

Ahmed


People also ask

How do I keep my Android app logged in?

When users log in to your application, store the login status into sharedPreference and clear sharedPreference when users log out. Check every time when the user enters into the application if user status from shared Preference is true then no need to log in again otherwise direct to the login page.

How can you save the state of activity?

When the activity goes into the background, the system calls onSaveInstanceState() . You should save the search query in the onSaveInstanceState() bundle. This small amount of data is easy to save. It's also all the information you need to get the activity back into its current state.

What is saving state in Android?

What is the savedInstanceState Bundle? The savedInstanceState is a reference to a Bundle object that is passed into the onCreate method of every Android Activity. Activities have the ability, under special circumstances, to restore themselves to a previous state using the data stored in this bundle.


1 Answers

use the below link.There is 3 way to store you login details . one is using shared preference and 2nd one way is store in a file and the third one is using sqlite. This will give you the ideas for storing login details.

save user data

like image 122
Asish AP Avatar answered Sep 18 '22 08:09

Asish AP