Thank you for the correction. I just removed that flag and everything
worked the same as you have stated. Guess I didn't experiment with it
as much as I should have.

Also, I have found a solution to my problem with auto cancel as well.

On Aug 20, 2:01 pm, Dianne Hackborn <[email protected]> wrote:
> Er.
>
> FLAG_ACTIVITY_NEW_TASK will be added for you if you haven't set it already,
> since the status bar is not part of a task, so it must launch the activity
> into a new task.
>
> And FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY has absolutely -no- impact on how
> the activity is launched -- it is just set by the task switcher to let
> applications know they were launched from there, but is not looked at in the
> tiniest bit by the platform.
>
>
>
> On Thu, Aug 20, 2009 at 8:56 AM, Rick <[email protected]> wrote:
>
> > After some experimenting with the suggestions given here, I ended up
> > changing the Intent flag from FLAG_ACTIVITY_NEW_TASK to
> > FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY and that has given me the desired
> > behavior which I believe would also do the same for your app Gustav.
>
> > While I'm here, I would like for the notification to clear once it is
> > clicked. As per your code I use the line "notification.defauls =
> > Notification.FLAG_AUTO_CANCEL;" however upon clicking the
> > notification, it still hangs around. Any ideas?
>
> > On Aug 18, 4:49 pm, Gustav Mauer <[email protected]> wrote:
> > > I have changed the intent to be as you have suggested, if I understand
> > > correctly. I have also tried with and without singleTask in the
> > > manifest for the launcher activity. With singleTask works a bit
> > > better, but control still goes back to the AppStart activity when
> > > clicking thenotification, even through that is not where I was when I
> > > pressed home.
>
> > > My current code is:
>
> > >         <activity android:name=".AppStart"
> > >                   android:label="@string/app_name"
> > > android:launchMode="singleTask">
> > >             <intent-filter>
> > >                 <action android:name="android.intent.action.MAIN" />
> > >                 <category
> > > android:name="android.intent.category.LAUNCHER" />
> > >             </intent-filter>
> > >         </activity>
> > >         <activity
> > >         ....
> > >         ....
>
> > >     private void statusbarNotification() {
> > >         PendingIntent contentIntent = PendingIntent.getActivity(context,
> > > 0,
> > >                         new Intent(Intent.ACTION_MAIN, null, context,
> > AppStart.class)
> > >                         .addCategory(Intent.CATEGORY_LAUNCHER)
> > >                         .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
> > >                         0);
>
> > >         String text = "Notificationmessage";
>
> > >         finalNotificationnotification= newNotification(
> > >                 R.drawable.icontabbar,
> > >                 text,
> > >                 System.currentTimeMillis());
>
> > >        notification.setLatestEventInfo(
> > >                 context,
> > >                 "Heading",
> > >                 text,
> > >                 contentIntent);
>
> > >        notification.defaults =Notification.FLAG_AUTO_CANCEL
> > +Notification.FLAG_ONLY_ALERT_ONCE;
>
> > >         nm.notify(NOTIFICATION_STATUS_ID,notification);
> > >     }
>
> > > Any ideas please on what I need to change?
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to