>>>>> "T" == TreKing  <treking...@gmail.com> writes:

   T> On Thu, Jan 17, 2013 at 4:14 PM, Jake Colman <col...@ppllc.com> wrote:

   >> When the application is recreated I assume that it loses the
   >> previous incarnations shared preferences and, therefore, the
   >> service doesn't know that it already triggered.  Hence, the false
   >> trigger when the application is recreated.
   >> 

   T> SharedPreferences are persisted if you commit them so any prefs
   T> you set in one call to Application.onCreate() should be available
   T> in the next call and throughout the rest of the app.

I am using PreferenceManager.getDefaultSharedPreference.  I am
committing my preferences when my Service (not the widget receiver but
the Service that is started by the widget receiver) is destroyed and I
read the preferences when the Service is created.  One of the saved
pieces of data stores whether the notification had already been
triggered.  Since the getDefaultSharedPreference method takes a context,
is it possible that when the Application is recreated there is a new
context so my saved preferences are lost?  That would explain why the
notification is re-triggered when the Application is created a second
time.

-- 
Jake Colman -- Android Tinkerer

-- 
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

Reply via email to