Push Notification overwriting old notification

Hi,

I am trying to create push notification for an app.
After receiving first notification on the android device the second notification overwrites the first instead of stacking on top of it. Following is my code

const options: PushOptions = {
android: {
senderID: “XXXXXXXXX”,
sound: true,
vibrate: true
},
ios: {
alert: “true”,
badge: false,
sound: “true”
},
windows: {}
};
const pushObject: PushObject = this.push.init(options);

pushObject.on('notification').subscribe((data: any) => {
  if (data.additionalData.foreground) {
  
  } else {
    
  }
});

pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));

You have to set the notId in the data object for the Android notification (when sending the notification), it’s done like this assuming you’re using the Ionic API for notifications:

{
	"tokens": ["DEVICE_TOKEN"],
	"profile": "PROFILE_TAG",
	"notification": {
		"message": "Hello World!",
		"ios": {
			"message": "Hello iOS!"
		},
		"android": {
			"message": "Hello Android",
			"data": {
				"notId": rand()
			}
		}
	}
}