1. Download our Official Android App: Forums for Android!

Apps SharedPrefrences Modes

Discussion in 'Android Development' started by ydn_dev, May 20, 2011.

  1. ydn_dev

    ydn_dev Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    May 10, 2011

    May 10, 2011
    3
    0
    5
    Hi,

    I'm a new Android developer. I'm using SharedPreferences to store some application settings. While I understand most of the usage scenarios and related APIs, MODES are still a mystery for me:
    1) Most of the books that I have read say that SharedPreferences cannot be shared across applications. Yet, there are modes:

    • MODE_WORLD_READABLE(allows all other applications to have read access to the created file).
    • MODE_WORLD_WRITABLE (allows all other applications to have write access to the created file)
    that control the OS level permissions set for the underlying xml file. But this also seems to suggest that sharing across applications is possible. So can I create a SharedPreferences object in APP-1 which refers to a SharedPreferences file created by APP-2. If so, how? Or will I need to use the I/O APIs to read /write preferences created by a different application. If io is the way to go, will changes made through I/O APIs generate callbacks on any registered SharedPreferencesChangeLsiteners in APP-1.

    2) MODE_MULTI_PROCESS looks like a feature to be added in the future. Am I right? Because the api documention for class SharedPreferences says: "currently this class does not support use across multiple processes. This will be added later".
     

    Advertisement

Share This Page

Loading...