Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

Local notification click event issue

$
0
0

@developer_med wrote:

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);
      });


     }
});

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>