GCX-HCI / tray

a SharedPreferences replacement for Android with multiprocess support
Apache License 2.0
2.29k stars 273 forks source link

How to share values between apps? #135

Closed sruthe closed 5 years ago

sruthe commented 5 years ago

tray Version ( 0.12.0)

From an app, I am writing values using AppPreferences(context).

How to make another app read the values? (since the context used for the AppPreferences will be different for different applications)

I could not find any sample. Please share the idea.

Currently I tried using context.createPackageContext(writerApp) and using this context in the 2nd app while creating appPreferences. It is working, but it requires both the apps having same “android:sharedUserId”.

Is there any other way?

StefMa commented 5 years ago

Hey @sruthe tray is not designed to share its Preferences with other apps!

When you want to do this you have to stick to ContentProviders.

StefMa commented 5 years ago

See also #134, #87 and #62