【发布时间】:2019-04-15 23:41:37
【问题描述】:
我正在使用 firebase 功能并发送如下通知
let pushPayload = {
notification: {
title: 'Doodles Notification',
body: "push testing",
sound: 'default',
badge: '1'
}
};
//push tokens need to be of customer as well as all the admins in the system. fetch admin push tokens
admin.messaging().sendToDevice(pushToken, pushPayload).then(
(resp) => {
console.log("push notification sent using test method")
return
}
).catch(
(err) => {
console.log("Error sending push notification:" + JSON.stringify(err))
return
}
)
客户端离子应用程序有如下方法:
this.fcm.onNotification().subscribe(data => {
console.log("push message is:" + JSON.stringify(data))
alert(data.aps.alert.body)
});
在 ios 上,这一切都很好。但是在 android 上,console.log 会打印
{"wasTapped":false}
我对上述预期属性没问题,但数据在哪里? firebase 文档对此感到困惑,我有点失去了我需要使用的正确有效负载,它适用于 ios 和 android。
【问题讨论】:
标签: android firebase google-cloud-functions cordova-plugin-fcm