Tuesday, November 19, 2013

[android-developers] Determine Application State (Foreground/Background) when onNewIntent() is called due to URL scheme

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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate