且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 FireBase 向 iOS 发送可操作的通知?

更新时间:2023-09-08 13:49:52

感谢 Malik 的回答.FCM 似乎将 android 特定的click_action"属性转换为 iOS 特定的category"属性.

Thanks Malik for the answer. FCM seems to translate the android specific "click_action" property to the iOS specific "category" property.

我们通过他们的 REST API 发送 firebase 推送通知,可以很容易地使用 postman 进行测试.

We send firebase push notifications via their REST API, which can be easily used for testing with postman.

这是 REST 版本:

Here is the REST version:

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

标题:

  • 授权:key=YOUR_FIREBASE_SERVER_KEY
  • 内容类型:应用程序/json

身体:

{ "notification": {
    "text": "YOUR_PUSH_TEXT",
    "click_action":"YOUR_IOS_ACTIONABLE_NOTIFICATION_CATEGORY"
  },
  "to" : "YOUR_PUSH_TOKEN",
  "data": {
    "YOUR_CUSTOM_DATA": "DATA"
  }
}