Re: [android-developers] Application.onCreate Method Randomly Called?

2013-01-17 Thread TreKing
On Thu, Jan 17, 2013 at 2:40 PM, Jake Colman  wrote:

>  If the application or widget is installed and that condition
> already exists at the time of installation, the notification is
> triggered.
>

That doesn't make sense. You can't do anything when your *application* is
first installed.


> Why would
> Application.onCreate be invoked by Android after the application and
> widget were already installed and without the user doing anything?
>

That would indicate your process was killed and restarted. If the widget
was the only thing you have running, then either it or perhaps the home
screen it was running on were killed. Not likely, but possible.

Why do this check in onCreate? Why not do it strictly when the widget is
installed?

-
TreKing  - Chicago
transit tracking app for Android-powered devices

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

Re: [android-developers] Application.onCreate Method Randomly Called?

2013-01-17 Thread Mark Murphy
I assume "widget" means "app widget".

In that case, is your app widget being updated, via
android:updatePeriodMillis or AlarmManager?

if the answer is "yes", then your process is being terminated in
between updates, then recreated on the next update, triggering a new
Application object and onCreate(). This is perfectly normal and
generally beneficial to the user.

On Thu, Jan 17, 2013 at 3:40 PM, Jake Colman  wrote:
>
> My application extends the Application class so that I can initialize
> ACRA in the onCreateMethod.  My application consists primarily of a
> widget that monitors something and sends a notification when a condition
> exists.  If the application or widget is installed and that condition
> already exists at the time of installation, the notification is
> triggered.
>
> I've started getting reports that the notification will trigger at
> random even after it has already triggered correctly.  I had the user
> send me my Debug Log with an email telling me when the notification was
> triggered.  Based on the timestamps the notification was triggered
> because Application.onCreate was invoked.  Why would
> Application.onCreate be invoked by Android after the application and
> widget were already installed and without the user doing anything?
>
> --
> 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



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.5 Available!

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


[android-developers] Application.onCreate Method Randomly Called?

2013-01-17 Thread Jake Colman

My application extends the Application class so that I can initialize
ACRA in the onCreateMethod.  My application consists primarily of a
widget that monitors something and sends a notification when a condition
exists.  If the application or widget is installed and that condition
already exists at the time of installation, the notification is
triggered.

I've started getting reports that the notification will trigger at
random even after it has already triggered correctly.  I had the user
send me my Debug Log with an email telling me when the notification was
triggered.  Based on the timestamps the notification was triggered
because Application.onCreate was invoked.  Why would
Application.onCreate be invoked by Android after the application and
widget were already installed and without the user doing anything? 

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