在通知栏上显示Ionic 3之前修改通知?

时间:2019-01-07 11:52:00

标签: angular push-notification ionic3 cordova-plugins phonegap-plugin-push

  1. 我正在IONIC 3中实现推送通知,并使用 phonegap-plugin-push
  2. 现在我想在通知栏上显示通知之前修改数据
  3. 这是我的代码

    pushNotificationSetup() {
      const options: PushOptions = {
      android: {
        senderID: 'xxxxxxxxx',
        icon: 'icon',
        sound: true,
        vibrate: true
      },
      ios: {
        alert: true,
        badge: true,
        sound: true,
      }
      };
      const pushObject: PushObject = this.push.init(options);
      pushObject.on('notification').subscribe((notification: any) => {
        this.utilService.showToastMsg("success", notification.message);
      });
    
      pushObject.on('registration').subscribe((registration: any) => {
        this.storageService.setLocalStorage('registered-device', registration.registrationId);
      });
    
      pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));
    }
    

0 个答案:

没有答案