How to implement authentication using common settings in android?

I'm new to Android.my requirements - this is to implement simple authentication logic for the login screen using sharedpreferences in android. can anyone suggest me ...?

+3
source share
1 answer

To save data after user registration (when the user is created) ...

// Get the app shared preferences
SharedPreferences login_app_preferences =  context.getSharedPreferences("LOGIN_DETAILS", MODE_PRIVATE);

// Update fields
SharedPreferences.Editor editor = login_app_preferences.edit();
editor.putString("email", strEmailOrLoginId);
editor.putString("password", strPassword);
editor.commit(); // Very important

To access it, somewhere in the application ....

// Get the app shared preferences
SharedPreferences login_app_preferences = context.getSharedPreferences("LOGIN_DETAILS", MODE_PRIVATE);

strUserName = login_app_preferences.getString("email", "");
strPassword = login_app_preferences.getString("password", "");
+4
source

All Articles