Thursday, March 17, 2011

Re: [android-developers] Notifications from Service

On Thu, Mar 17, 2011 at 9:00 AM, dashman <erjdriver@gmail.com> wrote:
> I'm creating a notification from a service to notify the main activity
> that a job is done.

Notifications notify the user, not an activity.

> The problem is when the user taps on the notification, it seems to
> create a new instance of the activity.

It will, by default. Calls to startActivity() create a new instance of
the activity, unless you take steps to the contrary.

> If i press BACK back, there's now 2.
>
> Is a way to instruction the notification object, to notify the
> existing
> activity.

Add FLAG_REORDER_TO_FRONT to your Intent that you put in the
PendingIntent that you put in the Notification that you put in the
status bar.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://bit.ly/smand1, http://bit.ly/smand2

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate