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非常感謝,你拯救我的生命:) –