From 464430ee742da3c5aff81b87e83d567c90d233ef Mon Sep 17 00:00:00 2001 From: Steven Luo Date: Sun, 29 May 2011 17:48:53 -0700 Subject: [PATCH] Add FLAG_ACTIVITY_NEW_TASK to notification intents According to http://developer.android.com/reference/android/app/Notification.html#contentIntent we should do this. Suppresses a log message when tapping on our status bar notification. --- application/src/org/yaaic/irc/IRCService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/application/src/org/yaaic/irc/IRCService.java b/application/src/org/yaaic/irc/IRCService.java index 83d731a..9ffcb3a 100644 --- a/application/src/org/yaaic/irc/IRCService.java +++ b/application/src/org/yaaic/irc/IRCService.java @@ -169,7 +169,9 @@ public class IRCService extends Service notification = new Notification(R.drawable.icon, "", System.currentTimeMillis()); // The PendingIntent to launch our activity if the user selects this notification - PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ServersActivity.class), 0); + Intent notifyIntent = new Intent(this, ServersActivity.class); + notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notifyIntent, 0); // Set the info for the views that show in the notification panel. notification.setLatestEventInfo(this, getText(R.string.app_name), "", contentIntent); @@ -201,7 +203,9 @@ public class IRCService extends Service if (foreground) { notificationManager.cancel(R.string.app_name); notification = new Notification(R.drawable.icon, text, System.currentTimeMillis()); - PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ServersActivity.class), 0); + Intent notifyIntent = new Intent(this, ServersActivity.class); + notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notifyIntent, 0); notification.setLatestEventInfo(this, getText(R.string.app_name), text, contentIntent); if (vibrate) {