0

我需要有关颤振通知的帮助。我已经在我的颤振应用程序中配置了 firebase_messaging。当我从 Firebase 控制台发送测试通知时,它们在前台和后台工作。当我从后端休息 api 服务发送通知时,它们仅在前台工作。即仅onMessage在这种情况下触发。

来自 REST API 的示例通知正文:

{notification: {title: null, body: null}, data: {intent: payment, body: 2500 shillings payment made, title: You have paid, click_action: FLUTTER_NOTIFICATION_CLICK}}
4

1 回答 1

0

"content_available":您应该在通知有效负载上 添加 true 。尝试使用此有效负载发送通知。

{ 
"to": "your title name", 
"content_available": true,
 "notification": {
 "title": "TITLE TEXT", 
"body": "BODY TEXT",
 "content_available": true
 },
 "data": { 
"body": "BODY TEXT",
 "title": "TITLE TEXT", 
"click_action": "FLUTTER_NOTIFICATION_CLICK"
 }
 }
于 2020-11-17T14:56:54.370 回答