I have a method like this:
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());
}
I am creating 3 three notifications like this:
createNotification("test1");
createNotification("test2");
createNotification("test3");
Notifications are creating without any problem.But when I touch the notification test1
or test2
it is calling test3
I mean all notification intents sets to last intent.How can I resolve it ?