Commit 21710850 authored by Varun Patil's avatar Varun Patil

Use unique notification id for PendingIntent

parent 3df7ad16
...@@ -54,11 +54,11 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService { ...@@ -54,11 +54,11 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
} }
/** In case the notification is dismissed */ /** In case the notification is dismissed */
protected PendingIntent getDeleteIntent(RemoteMessage remoteMessage) { protected PendingIntent getDeleteIntent(RemoteMessage remoteMessage, Integer notificationId) {
Intent intent = new Intent(getApplicationContext(), NotificationBroadcastReceiver.class); Intent intent = new Intent(getApplicationContext(), NotificationBroadcastReceiver.class);
intent.setAction(Constants.NOTIF_CANCELLED); intent.setAction(Constants.NOTIF_CANCELLED);
intent.putExtra(Constants.FCM_BUNDLE_NOTIFICATION_ID, remoteMessage.getData().get(Constants.FCM_BUNDLE_NOTIFICATION_ID)); intent.putExtra(Constants.FCM_BUNDLE_NOTIFICATION_ID, remoteMessage.getData().get(Constants.FCM_BUNDLE_NOTIFICATION_ID));
return PendingIntent.getBroadcast(getApplicationContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); return PendingIntent.getBroadcast(getApplicationContext(), notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT);
} }
@Override @Override
...@@ -93,7 +93,7 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService { ...@@ -93,7 +93,7 @@ public class InstiAppFirebaseMessagingService extends FirebaseMessagingService {
.setContentTitle(remoteMessage.getData().get(Constants.FCM_BUNDLE_TITLE)) .setContentTitle(remoteMessage.getData().get(Constants.FCM_BUNDLE_TITLE))
.setContentText(message) .setContentText(message)
.setContentIntent(getNotificationIntent(remoteMessage, notification_id)) .setContentIntent(getNotificationIntent(remoteMessage, notification_id))
.setDeleteIntent(getDeleteIntent(remoteMessage)); .setDeleteIntent(getDeleteIntent(remoteMessage, notification_id));
/* Check for article */ /* Check for article */
String largeContent = remoteMessage.getData().get(Constants.FCM_BUNDLE_LARGE_CONTENT); String largeContent = remoteMessage.getData().get(Constants.FCM_BUNDLE_LARGE_CONTENT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment