I am developing Android app A
so that another one B
could read A
's SharedPreferences
.
In javadoc for android.content.Context
the following is said about both MODE_WORLD_READABLE
and MODE_WORLD_WRITEABLE
:
This constant was deprecated in API level 17. Creating world-writable files is very dangerous, and likely to cause security holes in applications. It is strongly discouraged; instead, applications should use more formal mechanism for interactions such as
ContentProvider
,BroadcastReceiver
, andService
.
According to this, A
shall save its SharedPreferences
with MODE_PRIVATE
flag and provide a ContentProvider
, so that B
could query A
's ContentProvider
. But how do I know SharedPreferences
Uri?
I guess it's like content://authority_name/preference_file_name
but that doesn't work for me. I would appreciate any correct examples.
And in general, is it possible to access other app's MODE_PRIVATE
SharedPreferences
?