I'm working on an App, where I wanted the user to keep logged-in means always connected to the server after successful login(just like facebook app). I tried to google this but did not found any correct logic of this. Many website suggests to use SharedPreference
but keeping the user's login cred. on SheredPreference is not good idea and did not provide any answer to stay connected to the server. I'm kinda stuck with this idea. I just need logic to implement this. Any suggestions and example code are welcome.
I'm android noob.
Storing user's credentials on device is not a good way of designing. You can store the Hash
password, which is also denied as good application design technique. According to the facebook and google these tech giants use Authentication
token login-logout. Once the user log in server generate token for particular user which is then stored on your device as well as the server. Next time user come to App a request has been made to check the token is valid or not, if valid - access granted else not.
A basic design of this process
Tutorial :