【问题标题】:Azure Notification Hub + FCM Ionic 3Azure 通知中心 + FCM 离子 3
【发布时间】:2019-05-15 19:19:06
【问题描述】:

我正在尝试让推送通知正常工作。 从客户端应用开始,我将 FCM 插件添加到 ionic 项目中,导入 app.module.ts 并在提供程序中列出。

然后在 app.component.ts 中

import { FCM } from '@ionic-native/fcm';
constructor(..., public fcm: FCM) {

platform.ready().then(() => {
  ...
  this.fcm.getToken().then(token=>{
    console.log(token);
  });
  this.fcm.onNotification().subscribe(data => {
    if(data.wasTapped){
      console.log("Received in background");
    } else {
      console.log("Received in foreground");
    };
  });
  this.fcm.onTokenRefresh().subscribe(token => {
    //backend.registerToken(token);
    console.log('token changed ', token);
  });
  this.fcm.subscribeToTopic('general');
});
}

我想从 FCM 网站测试它是如何工作的。当我通过其令牌将其直接发送到设备时,它可以工作。当我将它发送到订阅“一般”主题的设备时,它也可以工作。但是当我将它发送给应用程序的用户时它不起作用,即使它显示我现在有 2 个用户。 example here

然后,我还将 FCM 服务器密钥添加到 Azure 通知中心,并想从 Azure 门户发送测试消息,但未传递。

如果我没有订阅 app.component.ts 中的任何主题,它也不会收到指定给应用程序所有用户的任何通知。

【问题讨论】:

标签: push-notification ionic3 firebase-cloud-messaging azure-notificationhub


【解决方案1】:

对这里的延迟回复表示歉意。只是从上面 Ajinka 的回复中跟进。 @Szymon,您在原始帖子中已声明“但是当我将其仅发送给应用程序的用户时它不起作用,即使它显示我现在有 2 个用户”,因为它不能直接与 FCM 一起使用,因此通常它不适用于 Azure 通知中心,因为 Azure 通知中心只是通过 FCM 发送它。因此,您必须通过 FCM 拳头识别和隔离问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-26
    • 1970-01-01
    • 2019-01-30
    • 1970-01-01
    • 1970-01-01
    • 2019-10-11
    • 2022-06-10
    • 1970-01-01
    相关资源
    最近更新 更多