使用 FCM,当应用程序在后台或未运行时,我会在系统托盘中收到推送通知。当应用程序处于前台时,我可以覆盖 onMessageReceived 并使用NotificationCompat
.
当我的应用程序在后台或未运行时,有没有办法创建提示通知?
谢谢
编辑:这里的参考是我通过 curl 使用的消息有效负载https://fcm.googleapis.com/fcm/send
{
"to":"push-token",
"content_available": true,
"priority": "high",
"notification": {
"title": "Test",
"body": "Mary sent you a message!",
"sound": "default"
},
"data": {
"message": "Mary sent you a Message!",
"notificationKey":"userID/notification_type",
"priority": "high",
"sound": "default"
}
}