0

We are saving the following from one application:

final CheckBoxPreference mCheckPref = new CheckBoxPreference(sContext);
mCheckPref.setKey("alertnotification");

and we are retrieving it from a second application follows:

mContext = context.createPackageContext("com.android.abc",Context.CONTEXT_INCLUDE_CODE |     Context.CONTEXT_IGNORE_SECURITY);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
boolean alertnotification = prefs.getBoolean("alertnotification",true);

I always get the alertnotification as false, even during the first time where I have set the default value to be true. Why does this happen?

AITAALI_ABDERRAHMANE
  • 2,499
  • 1
  • 26
  • 31
user1400538
  • 855
  • 5
  • 24
  • 42

1 Answers1

1

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

"Note: currently this class does not support use across multiple processes. This will be added later."

Max DeLiso
  • 1,213
  • 11
  • 23
  • is there any workaround for this, like using shareduserId between these apps as discussed [here](http://stackoverflow.com/questions/6354035/two-android-applications-with-same-user-id) – user1400538 Aug 27 '12 at 15:01