Android gcm通知有效载荷与数据有效载荷? [英] Android gcm notification payload vs data payload?

查看:127
本文介绍了Android gcm通知有效载荷与数据有效载荷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据
https://developers.google.com/cloud- messaging / server-ref
gcm message可以有通知有效载荷或/和数据有效载荷
这两者有什么区别?

解决方案

阅读您发送的链接在有效负载部分


有效负载



可选。如果您在邮件中包含有效内容,则可以使用
数据参数来包含您的自定义键/值对。客户端应用程序
处理数据负载以用于显示或其他处理目的。

具有预定义选项的notification参数表示GCM
将显示消息代表客户端应用程序,如果客户端应用程序
在Android上实现GCMListenerService,或者通知
消息发送到iOS设备。这适用于HTTP和XMPP。



应用服务器可以发送包含通知和
数据有效载荷的消息。在这种情况下,GCM处理显示通知
有效负载,客户端应用程序处理数据有效负载。



有关发送和接收$ b的详细信息,请参阅Server Reference $ b消息。



According to https://developers.google.com/cloud-messaging/server-ref gcm message can have notification payload or/and data payload What is the difference between these two?

解决方案

Reading on the link you send it is explained under Payload section

Payload

Optional. If you are including a payload in the message, you use the data parameter to include your custom key/value pairs. The client app handles the data payload for display or other processing purposes.

The notification parameter with predefined options indicates that GCM will display the message on the client app’s behalf if the client app implements GCMListenerService on Android, or if the notification message is sent to an iOS device. This applies for both HTTP and XMPP.

The app server can send a message including both notifications and data payloads. In such cases, GCM handles displaying the notification payload and the client app handles the data payload.

See the Server Reference for details on sending and receiving messages.

这篇关于Android gcm通知有效载荷与数据有效载荷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆