Here is what I met and what I did to fix it.
I triggered an alarm from Activity and Broadcast-Receiver from this alarm. I updated the Shared-Preferences that were read every time the application was launched.
After the alarm was started, whenever the application started, it received old values ββthat were set only from this activity. There were no changes from the broadcast receiver.
The trick here is to set general preferences as MODE_MULTI_PROCESS
Usually we use MODE_PRIVATE, but do the following:
SharedPreferences prefs = this.getSharedPreferences("Preferences", MODE_MULTI_PROCESS);
Note. After changing the mode in the code, it is recommended to clear the application data in order to avoid debugging problems.
EDIT: MODE_MULTI_PROCESS needs at least API 11
Before API 11, a workaround I can come up with is to create a database with 2 columns KEY and VALUE. Access to it is possible from other modules.
Kapil jituri
source share