Hello, i have an application that uses oneSignal push notifications.
in which i am handling the data.payload on recieving a notification and it works fine.
What i want is whenever i recieve a notification i want certain tasks to happen.
when i recieve the 1st notification, it enters the openOneSigalMessage and handleNotificationRecieved() and does everything inside the fuction but
When there is 2nd notification, it does receive the notification but does not enter the code.
Can anyone suggest me how can i call handleRecievedNotification() everytime so as to perform all task again whenever i get a Notification
For that i have written this code
openOneSignalMessage() {
this.oneSignal.handleNotificationReceived().subscribe((data) => {alert("Notification received:\n" + JSON.stringify(data)); console.log('Did I receive a notification: ' + JSON.stringify(data)); this.events.publish('Event1', data); console.log('Event 1 published from app components ') console.log('data payload', data.payload); console.log('data payload additional body', data.payload.additionalData.refresh); let refreshMsg = data.payload.additionalData.refresh if (refreshMsg == "TUGLIST") { this.events.publish('TuglistOfApp', refreshMsg); console.log('Entered if of tuglist of app.component'); } else if (refreshMsg == "TASKLIST") { this.events.publish('TasklistOfApp', refreshMsg); console.log('Entered if of Tasklist of app.component'); } }); console.log("Open Event Notification"); this.oneSignal.handleNotificationOpened().subscribe((data) => { });
}