From the name alone, I am guessing that Shared Preferences are… shared among apps?
That is, even if my app defines and creates them, any app on android can access them. Is this correct?
(If this isn’t correct, then why does the Data Storage Dev Guide emphasize Internal Storage as “Store private data”?)
If this is correct, can I modify this default behavior so that a preference is only visible from the app in which I define and create it?
If so, how do I do that?
If i’m correct you can make store it as private by calling
getSharedPreferences(yourfile, MODE_PRIVATE); public static final int MODE_PRIVATE
Since: API Level 1
File creation mode: the default mode, where the created file can only be accessed by the calling application (or all applications sharing the same user ID).
MODE_WORLD_READABLE MODE_WORLD_WRITEABLE Constant Value: 0 (0x00000000)
SharedPreferences are private by default. They are shared among the components of your app.
The getSharedPreferences in the Context class takes two arguments, String name and int mode. Mode determines if the shared preferences are private or not.