I have one app which is using different build variant(flavor), Now I want to share data between these flavored apps(different apps for End User). Now my question is that how can I use shared preferences to share some data amongst the flavored apps as only one package name mentioned in the manifest file and that one package is valid for all the flavored apps. I have tried the below approach and failed to share data.
//To set data
SharedPreferences settings = getSharedPreferences(MyPref, Context.MODE_WORLD_READABLE);
SharedPreferences.Editor editor = settings.edit();
editor.putString("UserEmail", m_email);
editor.putString("UserPass", m_pass);
editor.putString("LoggedUserName", m_statusData);
editor.commit();
//To Get data
Context con = getApplicationContext().createPackageContext("my_packagename", 0);
SharedPreferences pref = con.getSharedPreferences(MyPref, Context.MODE_PRIVATE);
EmailId = pref.getString("UserEmail", email);//got always null
Password = pref.getString("UserPass", Password);//got always null
But it is not working. What to do now?