Hi, I try to use my preferences within a broadcast receiver. I defined a preferences activity thats build of a defined UI (layout xml alias "prefrences.xml"). I am able to call the activity and edit the values. There is a preferences xml under my device at "/data/data/ <MY_PACKAGE_NAME>/shared_prefs/<MY_PACKAGE_NAME>_preferences.xml" that contains all of my values I defined in my layout.
In my broadcast receiver I tried to get a instance of my shared prefs. The only way is to use the intent of the onReceive method: ... public static final String PREFS_NAME = "preferences"; private SharedPreferences preferences; ... public void onReceive(Context context, Intent intent { ... preferences = getSharedPreferences(PREFS_NAME, 0); Log.d("prefs contain key", String.valueOf(preferences.contains("my_key"))); Log.d("prefs my_key is: ", String.valueOf(preferences.getBoolean("my_key", false))); ... ) I always got "false" for "my_key" and the contains key check is false too. I checked the path of my preferences in debug mode, its "/data/ data/<MY_PACKAGE_NAME>/shared_prefs/<PREFS_NAME>" but this file does not exists. I think I have to edit() and commit() first before accessing this file. My Question: am I able to get the preferences without create the new file first and use the existing preferences file (/data/data/ <MY_PACKAGE_NAME>/shared_prefs/<MY_PACKAGE_NAME>_preferences.xml)? There is no chance to obtain the preferences without the intent given through the onReceive method!(?). My aim is to create notifications based on preferences (vibration: on/off, sound: on/off, etc.) within the broadcast receiver. Hope someone can help me! Thanks! -Danny S. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en