我正在使用 cordova-plugin-firebase
插件来推送通知
,
它适用于 Android,但在 iOS 应用程序中,当应用程序处于后台状态时,不会收到推送通知
。
在 iOS 中 onNotificationOpen
不起作用。
try {
window.FirebasePlugin.onNotificationOpen(function (data) {
console.log(JSON.stringify(data));
console.log(data, 'data');
if (data.tap === true)
{
console.log('tapped');
self.ngZone.run(() => self.router.navigate(['/worklist'])).then();
}
else
{
console.log('not tapped');
cordova.plugins.notification.local.schedule({
title: data.title,
text: data.body,
foreground: true,
icon: '',
smallIcon: ''
});
}
});
} catch (e) {
console.log(e);
}
最佳答案
您可能必须在插件安装过程中将变量 IOS_HIDE_FOREGROUND_NOTIFIACION
设置为 false
。
关于ios - 如果应用程序位于 iOS 应用程序的前台,Cordova 插件 Firebase 不会收到推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55509827/