According to the docs for onNewIntent():

*"An activity will always be paused before receiving a new intent, so you
can count on onResume()
<http://developer.android.com/reference/android/app/Activity.html#onResume()>
being
called after this method.*"

The docs for onPause() state this:

"Called as part of the activity lifecycle when an activity is going into
the background, but has not (yet) been killed. The counterpart to
onResume()<http://developer.android.com/reference/android/app/Activity.html#onResume()>
."

Given this information I would say your app is ALWAYS in the background
when the new intent is received... There is no way around this.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Tue, Nov 19, 2013 at 6:55 PM, Piyush Hari <piyush.h...@gmail.com> wrote:

> onNewIntent() of MainActivity with launchMode 'singleTop' is called when
> application is invoked using its registered URL scheme.
>
> The order of call is :
>
> onPause (app is entering in background)
> onNewIntent (open url intent passed)
> onResume (app is in foreground)
>
> In onNewIntent(), how can one determine if application was running in
> foreground when the open url intent arrived ?
>
> If I decide to track the state using a flag "inForeground" that is
> initialized to "false" and set to "false" in onPause and "true" in
> onResume, applicationState will always be background (inForeground will be
> false in onPause).
>
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to