Push registration event called two times


#1

Hi guys,
I integrated push notification but I have a strange issue. Push registration event is called two times. I don’t understand why.

    this.pushObject.on('registration').subscribe((registration: any) => {
      alert ("Push registration");
    })

    this.pushObject.on('error').subscribe(error => {
      alert ("Push registration failed");
    });

    this.push.hasPermission()
      .then((res: any) => {
        if (res.isEnabled) {
          console.log('We have permission to send push notifications');
        } else {
          console.log('We do not have permission to send push notifications');
        }
      });

Could you please help me?
Thanks in advance
Luca


#2

Which plugin you are using and what is the version installed? I’m using cordova-plugin-fcm and it’s working fine.

this.fcm.onNotification().subscribe(data => {
      if (data.wasTapped) {
        this.goTo(data);
      } else {
      }
    });

the version of th eplugin is cordova-plugin-fcm 2.1.2 "FCMPlugin"