Currently I am working in ICS source. I want to remove(clear) the sharedpreferences of one application from
other application.
I have tried the following code in the other
application to remove preferences of application having package name
"com.android.blesettings":
Context context = getActivity().createPackageContext(
"com.android.blesettings", 0);
SharedPreferences mSettings = mSettingsContext.getSharedPreferences(
"profile_preference", MODE_WORLD_READABLE);
SharedPreferences.Editor mSettingsEditor = mBLESettings.edit();
mSettingsEditor.clear();
mSettingsEditor.commit();
File file = new File(
"/data/data/com.android.blesettings/shared_prefs/profile_preference.xml.bak");
file.delete();
I
am able to remove(clear) the value of the sharedpreference of
application(that I have observed by looking the "profile_settings" file)
but it is taking value(previously saved) from the .bak file of the sharedpreferences.
I am unable to delete the .bak file of the sharedpreferences(profile_preference) of application having package name
"com.android.blesettings".
I have used the same sharedUserId inside the manifest tag of AndroidManifest.xml of both applications (e.g.android:sharedUserId="android.uid.system")
How to resolve this issue? Is it possible with SharedPreferences?
Any help or guidance will be well appreciated.