Friday, September 16, 2011

Re: [android-developers] Intent.FLAG_ACTIVITY_REORDER_TO_FRONT does not work with PendingIntent

If you want to bring your whole task to the front, build an Intent which is the same thing used to launch it -- ACTION_MAIN, CATEGORY_LAUNCHER, and the component name set to the class if your root activity.

On Fri, Sep 16, 2011 at 3:33 PM, Shri Borde <shri.borde@gmail.com> wrote:
I guess I can create a trampoline Activity which gets launched by clicking on the notification icon, and it could then start MyActivity using FLAG_ACTIVITY_REORDER_TO_FRONT. A bit of a pain which PendingIntent would have supported itself, but I can give this a shot.


On Fri, Sep 16, 2011 at 3:22 PM, TreKing <trekingapp@gmail.com> wrote:
On Fri, Sep 16, 2011 at 1:37 PM, Shri <shri.borde@gmail.com> wrote:
However,
this does not seem to work even though I set
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT - a new instance gets created if
MyActivity was not on top of my task's stack.

http://developer.android.com/reference/android/app/PendingIntent.html#getActivity(android.content.Context, int, android.content.Intent, int)

"Note that the activity will be started outside of the context of an existing activity, so you must use the Intent.FLAG_ACTIVITY_NEW_TASK launch flag in the Intent."

It might get set for you if you don't specify it.

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



--
Dianne Hackborn
Android framework engineer
hackbod@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

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

No comments:

Post a Comment