【问题标题】:Notifications delivered to both device and app when app is running in the foreground on iOS using Cordova Firebase Plugin使用 Cordova Firebase 插件在 iOS 上的前台运行应用程序时向设备和应用程序发送通知
【发布时间】:2019-03-12 13:03:06
【问题描述】:

我有一个有趣的问题,我正在尝试使用插件 cordova-plugin-firebase (https://github.com/arnesson/cordova-plugin-firebase) 在 iOS 上解决。通过 Firebase 控制台或 cURL 代码发送通知可以正常工作,但通知始终会同时发送到设备通知中心并显示在应用程序中,即使它是前台也是如此。根据文档,通知流程应该是当应用程序在前台时通知不会传递到设备。我没有对应用程序委托或插件代码等进行任何修改。所以我不确定从哪里开始调试。

这是我的代码中的 onNotificationOpen 回调,只要应用程序处于前台或打开通知时,它就会被调用

window.FirebasePlugin.onNotificationOpen(function(notification) {
console.log(notification);
alert(notification);
 }, function(error) {
   console.error(error);
});

Cordova iOS 平台是 4.5.5。 cordova-plugin-firebase 是 2.0.3,设备 iOS 是 12.0

【问题讨论】:

标签: ios xcode firebase cordova firebase-cloud-messaging


【解决方案1】:

我建议使用OneSignal 进行通知。

仪表板是用户友好的,您可以对设备进行分段并将通知发送到特定设备。

这是setup的链接

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-10
    • 2018-06-15
    • 2017-12-04
    • 1970-01-01
    • 2013-01-30
    相关资源
    最近更新 更多