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

LocalNotifications doesn't update after event

$
0
0

@marcelodeandrade0201 wrote:

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

        });

    });

  }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70908

Trending Articles



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