how to stay logged in android code example
Example: android how to keep users logged in
sharedpreferences = getSharedPreferences("autoLogin", Context.MODE_PRIVATE);
int j = sharedpreferences.getInt("key", 0);
if(j > 0){
Log.i("Loogged in","your in");
Intent activity = new Intent(getApplicationContext(), DashActivity.class);
startActivity(activity);
}
else
{
Log.i("Not luck","your not in");
}
SharedPreferences sharedPreferences;
sharedPreferences = getActivity().getSharedPreferences("autoLogin", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt("key", 0);
editor.apply();