I have a need to share preferences between two apps, where one app
writes the preferences and the other needs read only access.

I notice that there is this API available in Context :

public abstract SharedPreferences   getSharedPreferences  (String
name, int mode). Where I can set the mode to : MODE_WORLD_READABLE
which according to docs means that it will allow all other
applications to have read access to the created file.

My question is : What should be my filename so that the file gets
created and is shared between the apps.

If I give a relative path (getSahredPrefs("filename",
MODE_WORLD_READABLE)) then it gets created in the "data" directory of
the writing app and the other non creating application is not able to
get to it using the same arguments i.e. - getSahredPrefs("filename",
MODE_WORLD_READABLE).

So I assume I need to provide a absolute path - something like ("/data/
data/<pkgname>/<subdir>/filename", MODE_WORLD_READABLE)  but I do not
know how to construct that generically using provided APIs so that it
works on every Android phone/image.




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to