LocalNotifications doesn't update after event


#1

When enable, the notification fire a random message from this.getMessage(), and every time the message is changed and notification is updated but doesn’t fire that changes. What is my mistake?

onEnable() {

    this.getMessage().then(() => {

      console.log(this.message);

      let notification = {
        id: 99,
        title: this.message.title,
        message: this.message.message,
        every: 'minute'
      };

      this.localNotifications.schedule(notification);

    }).then(() => {

      this.onUpdate();

      let alert = this.alertCtrl.create({
          title: 'Notifications set',
          buttons: ['Ok']
      });
      alert.present();

    });


  }

  onUpdate() {
    console.log("onUpdate");

    this.localNotifications.on("trigger", function(localNotifications){
          console.log("triggered");

        this.getMessage().then(() => {

          console.log(this.message);

          let notification = {
            id: 99,
            title: 'updated',
            message: this.message.message,
            every: 'minute'
          };

          localNotifications.update(this.notification);
          
        });

    });

  }