On Tue, Apr 8, 2014 at 4:21 AM, Jia Li <jarlym...@gmail.com> wrote: > 1. How to detect if the application is in foreground, background or not > running? >
Why do you need to do this? You get a GCM message, you respond to it. Whether the app is foreground or background ("not running" is not an option - if you're responding to the message, you're running) is irrelevant. 2. How to find out the top activity if the app is running (either > foreground or background) > Again, why do you care? > 3. If it is not running, how to launch it. > If you get a GCM message and can handle that message, your app is running. > 4. If it is running in background, how to bring it to foreground > Call startActivity, just like normal. ------------------------------------------------------------------------------------------------- TreKing <http://sites.google.com/site/rezmobileapps/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 --- 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/d/optout.