3
我在使用cordova fcm插件的离子框架中使用Firebase通知。我想在用户收到推送通知并点击它时打开一个状态。我使用params发送来自Firebase控制台的通知,但它始终是data.was已跳过错误,这就是为什么它不起作用。离子FCM始终为空
FCMPlugin.onNotification(function(data)
{
if (data.wasTapped) {
//Notification was received on device tray and tapped by the user.
console.log("Tapped: " + JSON.stringify(data));
if (data.hasOwnProperty('state')) {
$timeout(function(){
$state.go(data.state);
})
}
}
else
{
//if user already opened app
console.log("Not tapped: " + JSON.stringify(data));
}
}, function(msg) {
console.log('onNotification callback successfully registered: ' + msg);
}, function(err) {
console.log('Error registering onNotification callback: ' + err);
});
当我将在有效载荷通知阵列,我已经收到两份通知 – Sakshi
@Adam史密斯: - 我已经申请了,还是同样的问题 –
@Adam非常感谢,你拯救我的生命:) –