我们正在使用Google Cloud Messaging API推送Android通知。我们正在执行https://android.googleapis.com/gcm/send端点,其有效负载类似于:
{
"registration_ids" : ["..."],
"data" : {
"message" : "You received cash back!"
}
}
通知有效,手机会显示我们的应用徽标以及上面的消息。但是,通知中没有标题(在消息上方和徽标右侧):
作为参考,我们正在使用Phonegap 3.3和PhoneGap Build。
答案 0 :(得分:10)
嗯,在黑暗中加入“标题”固定它。我无法在http://developer.android.com/google/gcm/server.html#params
中找到此文档{
"registration_ids" : ["..."],
"data" : {
"message" : "You received cash back!",
"title" : "Title"
}
}
现在在docs中: https://developers.google.com/cloud-messaging/server#payload
答案 1 :(得分:1)
查看文档here:
{
"registration_ids" : ["..."],
"notification" : {
"body" : "You received cash back!",
"title" : "Title",
"icon": "ic_notification" // replace with your own
}
}
答案 2 :(得分:0)
它在我身边工作
$ message = array(“message”=> $ pushMessage,“title”=>“我的通知”);
$ fields = array(
“registration_ids”=> “device id to send notification
”,
“data”=> $消息
);