SharedPreferences to keep session
-
26-09-2019 - |
Question
I make an app with some activities. The first is the login. If I login correctly, I pass to the second activity, and I want download a stream (like twitter), but I cannot keep the session.
I saved user & pass in sharedpreferences, how can i keep the session througt all activities?
Solution
You have to get the data back from shared preferences.
Careful though using shared prefs for logins. You would have to encrypt it. I can not remember if this is possible with shared prefs.
Shared preferences is generally not the best solution when it comes to logins.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow