Yup, Thats right. Let me correct my self a bit. Both the apps should
use the same User ID.

http://developer.android.com/reference/android/content/SharedPreferences.html

The docs say that, as of now,
Note: currently this class does not support use across multiple
processes. This will be added later.

At this point, I am a bit confused.
@Lance: Perhaps you are right. But I thought, apart from the
permission, you need to have the same User ID.

-Kumar Bibek
http://techdroid.kbeanie.com

On Sep 23, 1:20 am, Lance Nanek <[email protected]> wrote:
> I have a paid app that reads the SharedPreferences from a free app of
> mine. Works fine. You don't have to use a ContentProvider.
>
> You do have to set the mode properly when you set the preferences.
> That's when the preferences file is created.
>
> This may not be your problem, but you are also settings the flags
> parameter in the createPackageContext call incorrectly. Check the
> documentation for that method, that is not one of the flags it
> accepts.
>
> On Sep 20, 9:17 am, "swapnil.kolhapur" <[email protected]>
> wrote:
>
> > Hi ,
>
> > I have a need to share preferences between two apps, where one app
> > writes the preferences and the other application needs read only
> > access.
>
> > I notice that there is this API available in Context :
>
> > So i am trying to use it by following code,
>
> > myContext =
> > createPackageContext("com.xyz",Context.MODE_WORLD_READABLE);
> > SharedPreferences testPrefs =
> > myContext.getSharedPreferences("preferences",
> > Context.MODE_WORLD_READABLE);
> > boolean valueFromPrefs = testPrefs.getBoolean("synchcheckboxPref",
> > false);
>
> > but i am not able to get the correct values ?
>
> > Do i need to handle mode while i create the preferences. I have
> > created preferences in com.xyz used xml to define some field
>
> > Regards,
> > Swapnil

-- 
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