SharedPreferences values not retrieved from a service when called from another activity that created them
<p>Good day, am having a quite baffling problem and its supposed to be pretty much straightforward. i have this 3 class:</p>

<pre><code>1.A config activity that creates and saves sharedpreferences.

2.A service.

3.Another Activity B
</code></pre>

<p>From the Config Activity, i save in this manner:</p>

<pre><code>prefs = getSharedPreferences(MY_PREF_NAME, MODE_WORLD_READABLE);

 boolean toggleCheck = toggleCelsius.isChecked();
 boolean currentLocation = mylocation.isChecked();
 boolean searchLocation = search.isChecked();
 int updateSet = update.getSelectedItemPosition();

 Editor editor = prefs.edit();
 editor.putString(CITY + appWidgetId, city);
 editor.putBoolean(GPS_LOCATION + appWidgetId, currentLocation);
 editor.putBoolean(SEARCH_LOCATION + appWidgetId, searchLocation);
 editor.putBoolean(CHECKED_CELSIUS + appWidgetId , toggleCheck);
 editor.putInt(REFRESH_UPDATE + appWidgetId, updateSet);
 editor.commit();
</code></pre>

<p>and i retrieve from the service onCreate() Method this way:</p>

<pre><code> SharedPreferences prefs = this.getSharedPreferences(myCastConfigure.MY_PREF_NAME, MODE_WORLD_READABLE); //have tried using getApplicationContext()
 city = prefs.getString(CITY + appWidgetId,"nothing");
 chk_celsius = prefs.getBoolean(CHECKED_CELSIUS + appWidgetId, true);
 updateRate = Configure.convertToMillis(prefs.getInt(REFRESH_UPDATE + appWidgetId, 1));
</code></pre>

<p>After i save the preferences, the service starts and i can retrieve the sharedPreferences Value from the service.But when i try to restart the service from the Activity B, i don't retrieve the sharedpreference value from the service anymore. instead i get the value "nothing". I have tried using getApplicationContext() from the service, but that doesn't seem to help too! can anybody please explain whats going on and give suggestions. Thank you.</p>
