IOS 中的 Fluter Firebase 推送通知 - 背景通知不包含图像

时间:2021-06-25 16:17:04

标签: ios firebase flutter dart firebase-cloud-messaging

 firebase_core: ^1.2.1
  firebase_crashlytics: ^2.0.5
  firebase_remote_config: ^0.10.0+1
  firebase_messaging: ^10.0.1
awesome_notifications: ^0.0.6+9

以上是我在项目中使用的依赖项,以便使用 fcm 推送通知。在前台和后台均在 Android 中使用图像推送通知。 仅当应用程序在前台时才在 iPhone 中使用图像推送通知,但当应用程序在后台时,会出现默认通知。

我使用默认的 fcm google API 通过将令牌作为请求传递到正文中来测试 fcm 推送通知:

https://fcm.googleapis.com/fcm/send

请求:

{
   "to": "fZ2Y2e4uN048rkq2R2d......",
   "content_available": true,
   "mutable_content": true,
   "priority" : "high",
   "data":
   {
      "message": "Offer!",
      "mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG",
      "image" : "image.png",
      "title": "Title",
      "body" : "body"
   },
   "notification":
   {
      "body": "body",
      "title": "title",
      "sound": "default",
      "mediaUrl": "image.png"
   }
 

当应用程序在 iPhone 的后台时,我是否需要添加更多规范才能在推送通知中显示图像?

如果有人遇到同样的问题,请帮助我。

提前致谢。

0 个答案:

没有答案
相关问题