Skip to content

Commit 56e3af7

Browse files
committed
Add PendingIntent.FLAG_UPDATE_CURRENT to action button intents
Without it, if the hashCodes matches a button from one of the previous notifications, the pending intent won't be updated, and it may perform an action from the old message.
1 parent 7775b92 commit 56e3af7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableNotificationBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void createNotificationActionButton(Context context, IterableNotification
119119
buttonIntent.putExtra(IterableConstants.ACTION_IDENTIFIER, button.identifier);
120120

121121
PendingIntent pendingButtonIntent = PendingIntent.getBroadcast(context, buttonIntent.hashCode(),
122-
buttonIntent, 0);
122+
buttonIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
123123

124124
NotificationCompat.Action.Builder actionBuilder = new NotificationCompat.Action
125125
.Builder(NotificationCompat.BADGE_ICON_NONE, button.title, pendingButtonIntent);

0 commit comments

Comments
 (0)