1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-22 08:52:18 -05:00

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.
This commit is contained in:
Steven Luo 2011-05-29 17:48:53 -07:00 committed by Sebastian Kaspari
parent caf3272f71
commit 464430ee74

View File

@ -169,7 +169,9 @@ public class IRCService extends Service
notification = new Notification(R.drawable.icon, "", System.currentTimeMillis()); notification = new Notification(R.drawable.icon, "", System.currentTimeMillis());
// The PendingIntent to launch our activity if the user selects this notification // 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. // Set the info for the views that show in the notification panel.
notification.setLatestEventInfo(this, getText(R.string.app_name), "", contentIntent); notification.setLatestEventInfo(this, getText(R.string.app_name), "", contentIntent);
@ -201,7 +203,9 @@ public class IRCService extends Service
if (foreground) { if (foreground) {
notificationManager.cancel(R.string.app_name); notificationManager.cancel(R.string.app_name);
notification = new Notification(R.drawable.icon, text, System.currentTimeMillis()); 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); notification.setLatestEventInfo(this, getText(R.string.app_name), text, contentIntent);
if (vibrate) { if (vibrate) {