Home » Android » What's the maximum size for an Android shared preference value?

What's the maximum size for an Android shared preference value?

Posted by: admin April 23, 2020 Leave a comment

Questions:

I fully appreciate dumping lots of data into the preferences is totally inappropriate, but my requirement is not that great, but large enough (potentially 500-5000 bytes) where I’ve no idea whether it’s appropriate or not. The docs do not help.
http://developer.android.com/reference/android/content/SharedPreferences.Editor.html

I’ve searched the net and Stackoverflow and can’t find a definitive answer on:
a) what the actual limit is, based on the underlying architecture
b) what the practical limit is, based on performance (I find writing even short pref values can take a few seconds, but I suspect that’s just a flash write delay)

Would appreciate clarification.

How to&Answers:

All shared prefs are stored in /data/data/[package name]/shared_prefs/[app name].xml, so i think there’s no limit based on architecture.

I don’t know practical limit but I think it’s enough for you.