【问题标题】:Ionic FCM push notifications observable does not emit可观察到的 Ionic FCM 推送通知不会发出
【发布时间】:2018-03-08 21:39:03
【问题描述】:

我在离子应用程序中执行以下操作:

  1. 当用户登录时,订阅他们的用户 ID 主题
  2. 当推送通知到达时,console.log 某事。

    this.authState.subscribe((state) => {
        if (state) {
            this.fcmPush.subscribeToTopic(state.uid);
    
            this.fcmPush.onNotification().subscribe(notification => {
                if (notification.wasTapped) {
                  console.log('Received in background', notification);
                } else {
                  console.log('Received in foreground', notification);
                }
            });
        }
    });
    

来源:https://github.com/AmitMY/ionic-starter-firebase/blob/master/src/app/app.component.ts#L118

向我自己的主题发送通知到达(几分钟后),但我从未在控制台中看到任何东西,无论是来自应用程序外部还是应用程序内部。

我做错了什么?

【问题讨论】:

    标签: ionic-framework ionic2 cordova-plugin-fcm


    【解决方案1】:

    从 firebase 消息发送通知不起作用。 但是,使用 sdk 我必须添加:

    click_action: "FCM_PLUGIN_ACTIVITY",

    在使用指南中但我错过了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-11
      • 1970-01-01
      • 2020-09-17
      • 1970-01-01
      • 2022-08-22
      • 2017-06-13
      • 2020-04-21
      相关资源
      最近更新 更多