On Wed, Aug 22, 2012 at 8:33 AM, user123 <[email protected]> wrote: > I want to detect each time the user opens the app, by tap on home / desktop > icon. There seem not to be a straight forward way to do it. Found a few > workarounds but nothing seems to be really reliable.
The invoking intent will have action "android.intent.action.MAIN" and category "android.intent.category.LAUNCHER". > Things like, extend application object and use method "onCreate()", but this > is not what I need because it's not called always when the user taps on the > app's icon (can be just brought from the background), In this case onResume() will be called, but not onCreate. > and also the > application may be destroyed and recreated while running. Then > Application.onCreate() will also be called. You can differentiate this situation by the fact that in the first invocation the Bundle passed to onCreate() is null. When the activity is recreated onCreate receives a copy of the intent given to onSaveInstanceState() before onStop() is called. -- "The flames are all long gone, but the pain lingers on" -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

