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

