IrA*_*App 5 android push-notification ios firebase firebase-cloud-messaging
我正在使用FCM展位平台发送项目通知,iOS并且Android. 以下是payloads我要发送的:
{ \n "to":"user_key",\n "priority":"high",\n "content_available":true,\n "mutable_content":true,\n "data":{\n "body":"test"\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n阅读文档后,发送和通过Firebase时的行为是:notificationdata payloadFCM
iOS系统
\n\nnotification如果->body未定义,您将看不到横幅。安卓
\n\ndata payload,则在 时才会收到数据background。notification_payload,system tray就会处理。事情是:
\n\n因为Android我想避免notification_payload在应用程序处于后台时通过传递来接收数据(这样 onMessageReceived() 将被调用)。但是,我不会\xc2\xb4tnotifications收到iOS.
感谢帮助/建议。
\n小智 1
服务器应该对 IOS 和 Android 推送请求使用不同的 json 结构。例如:
安卓:
[data] => Array
(
[title] => Test
[message] => Message
)
Run Code Online (Sandbox Code Playgroud)
苹果系统:
[notification] => Array
(
[title] => Title
[body] => Body
[sound] => 1
[vibrate] => 1
)
[data] => Array
(
[custom_key] => custom_value
)
Run Code Online (Sandbox Code Playgroud)
您可以根据您的任务对其进行编辑。
| 归档时间: |
|
| 查看次数: |
2532 次 |
| 最近记录: |