问题
Is there a difference between storing service authentication token in Internal storage (in file) and in Shared Preferences?
回答1:
Not really, it's a matter of convenience. With shared preferences you don't need to handle file IO.
回答2:
shared preference will be better than to store credential in file, to open and readfile is tedious compare to use of share preference
回答3:
Although both can be private types. The conventional approach is: if you have small key value pair go with shared preference. If you have large chunk of data go with Internal storage. Internal storage stores in files and is private to your application. The major drawback with shared pref. is if your app crashes/ force close you lose all your data in shared pref.
Verdict:
If you use shared pref. make sure your app doesn't crash. So my point of view: go with internal storage. Nevertheless, if your phone is rooted ANYTHING can happen, nothing remains private anymore... :/
来源:https://stackoverflow.com/questions/7076304/android-internal-storage-vs-shared-preferences