I am trying to access shared preferences from a service. I have used the the following to save the value of text to a string...
SharedPreferences sharedPrefe
I'm always using PreferenceManager.getDefaultSharedPreferences(context). This is the same for all Contexts in your application.
PreferenceManager.getDefaultSharedPreferences(context)
Context
A Service is a Context itself, so this would be sufficient:
Service
PreferenceManager.getDefaultSharedPreferences(this);