【发布时间】:2015-02-03 00:28:19
【问题描述】:
我有这样的方法:
private void createNotification(String sender) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setContentTitle(sender+" sent you a message")
.setAutoCancel(true)
.setSmallIcon(R.drawable.ribony_top_icon)
.setContentText("Touch for reply")
Intent resultIntent = new Intent(this, LoginActivity.class);
resultIntent.putExtra("gcm_username",sender);
resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent resultPendingIntent = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(NotificationID.getID(sender), mBuilder.build());
}
我正在创建 3 三个这样的通知:
createNotification("test1");
createNotification("test2");
createNotification("test3");
通知正在创建没有任何问题。但是当我触摸通知test1 或test2 它正在调用test3 我的意思是所有通知意图都设置为最后一个意图。我该如何解决它?
【问题讨论】:
标签: android