Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to save login details of android app?

Tags:

android

login

I have a android application which needs username and password to login. I need to save the username and password locally in phone or somewhere to use them when the user opens the app next time and logins to the app automatically without showing the login screen

    EditText input1 = (EditText) findViewById(R.id.usertext);
    EditText input2 = (EditText) findViewById(R.id.Passtext);
    String username = input1.getText().toString();
    String password = input2.getText().toString();

If the login is successful, it will call the activity through intent.

like image 299
Srikanth Naidu Avatar asked Jun 21 '10 14:06

Srikanth Naidu


2 Answers

If you are using ApiLevel >= 5 read about AccountManager.

like image 125
Macarse Avatar answered Oct 05 '22 12:10

Macarse


I would recomend to use something like MD5 or SHA1 for hashing your password before storing.

A possible place to store could either be "preferences" or the sqlite DB (not such usefull for only one single dataset)

like image 20
poeschlorn Avatar answered Oct 05 '22 11:10

poeschlorn