I want to know how to save single object(for example user's token) to file system. Is shared preferences best practices? Or it be better to use table with single row or something else?
Asked
Active
Viewed 70 times
-2
-
shared preferences is recommanded. – Kaushik Burkule Oct 16 '19 at 12:05
-
[How to securely store access token and secret in Android?](https://stackoverflow.com/questions/10161266/how-to-securely-store-access-token-and-secret-in-android) – Ricardo A. Oct 16 '19 at 12:29
-
if you like any answer you can surely upvote it.. but please don't downvote an answer unless it's totally wrong. Thank you :) Cheers! – Kishita Variya Oct 16 '19 at 12:53
-
I didn't downvote any answer. They are all good and more or less the same. Thanks for help – григорий юрков Oct 16 '19 at 14:01
2 Answers
2
If your user token is session based (change at every application launch) then it would be better to save in application cache.
If your user token not change as per application life-cycle, then shared preference is best option.

Hardik Bambhania
- 1,732
- 15
- 25
-1
Shared prefrences will be the best choice, https://github.com/Pixplicity/EasyPrefs here is a library to make it easier for you aswell

Ruben Meiring
- 333
- 2
- 21