On Sun, Jun 12, 2011 at 6:09 PM, dashman <[email protected]> wrote: > My app has an service that does a background job. > > On completion, I post a notification...when the user > taps on the notification...it shoots an Intent to my > main UI activity and loads it w/ data from the service > (passed as Intent extras). > > Problem is some users are getting confused with > this extra step requirement (e.g. can't find > notification bar???) > > Is there any way from my service to directly invoke > my main activity (same app) and load w/ passed data.
A Service can call startActivity(). However, this is very intrusive, as it will take over the foreground no matter what the user is doing -- playing a game, typing a text message, whatever. For some apps, this is apropos (e.g., VOIP client for incoming phone call, alarm clock). All other apps should at most make this an optional feature. > Important requirement - if an instance is already > running (which will be most of the time) - i would like > that instance to be updated. Use FLAG_ACTIVITY_CLEAR_TOP|FLAG_ACTIVITY_SINGLE_TOP as the flags on your Intent. If an instance of your activity is already running, it will be brought to the foreground and called with onNewIntent(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- 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

