hi guys, i use push notification to push notif in ly app when app is not running the notif is set in notification bar and i when i click on notification i redirect user to another page that’s good,
but when app is running the notif does not appear in notification bar and catch to do that i installed local notification to do the trick and it does it good and i want to catch also click on those local notification that’s good probleme is when i click on notification the block in catch execute on time for second time when i click also on an other notif the catch block execute twice in 3 click the block execute 3 like a loop but i dont see way that’s should execute one time for each click
pushObject.on('notification').subscribe((notification: any) => {
console.log('Received a notification : ', notification);
if (!notification.additionalData.foreground) {
// app is NOT RUNNING and new notification is RECEIVED
let page = ListingNotificationsPage;
this.events.publish('navTo', page);
}
else {
// app is RUNNING and new notification is RECEIVED
// Schedule a single notification
this.localNotifications.schedule({
id : notification.additionalData.notId,
title: notification.title,
text: notification.message,
//smallIcon: 'res://notification_icon',
icon: 'file://assets/img/notification_icon.png'
});
console.log('Received a notification on foreground: ', notification);
//click
this.localNotifications.on('click', (notification, state) => {
console.log("click :: ",notification.id);
alert("click :: "+notification.id);
});
}
});