This happens to my app very infrequently also.  I also use ACRA and ACRA 
crashes because it detects that its init() method was called twice (from 
Application.onCreate())

The only way ACRA init knows that it was called twice is if it wasn't 
killed between invocations.  So this is almost certainly an Android/vendor 
bug where it calls onCreate() multiple times under some special conditions 
without killing the app in between the calls.


On Friday, January 18, 2013 11:29:37 AM UTC+8, Jake Colman wrote:
>
> >>>>> "T" == TreKing  <treki...@gmail.com <javascript:>> writes: 
>
>    T> On Thu, Jan 17, 2013 at 4:14 PM, Jake Colman 
> <col...@ppllc.com<javascript:>> 
> 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