How can I share data between Two Android Apps using Shared Preferences?
<p>I have Two Apps, App1 and App2. I want to save data in App1 using shared preference and access in App2 and vice versa.
I'm able to save data in App1 and access in App2 but not the opposite.</p>

<p>This is what I'm doing now :</p>

<p>In Manifest:</p>

<pre><code>android:sharedUserId="any string"
android:sharedUserLabel="@string/any_string"
</code></pre>

<p>In App1:</p>

<pre><code>SharedPreferences prefs = getSharedPreferences("demopref",Context.MODE_PRIVATE);
SharedPreferences.Editor editor =prefs.edit();
editor.putString("demostring", strShareValue);
editor.commit();
</code></pre>

<p>In App2:</p>

<pre><code>try {
con = createPackageContext("com.sharedpref1", 0);
SharedPreferences pref = con.getSharedPreferences("demopref", Context.MODE_PRIVATE);
String your_data =
pref.getString("demostring", "No Value");
}
catch (NameNotFoundException e) {
Log.e("Not data shared", e.toString());
}
</code></pre>

<p>Guys any clue ?</p>