Reputation: 387
We are using the Google Cloud Messaging API to push Android notifications. We are executing the https://android.googleapis.com/gcm/send endpoint with a payload similar to:
{
"registration_ids" : ["..."],
"data" : {
"message" : "You received cash back!"
}
}
The notification works and the phone shows our app logo, and the message from above. However, there is no title in the notification (above the message and to the right of the logo):
For reference, we are using Phonegap 3.3 and PhoneGap Build.
Upvotes: 2
Views: 8858
Reputation: 2322
Have a look at the documentation here:
{
"registration_ids" : ["..."],
"notification" : {
"body" : "You received cash back!",
"title" : "Title",
"icon": "ic_notification" // replace with your own
}
}
Edit: cloud messaging is now deprecated and this example is no longer valid. The link to the updated documentation is at firebase
Upvotes: 1
Reputation: 33
its working my side
$message = array("message" => $pushMessage,"title" => "My Notification");
$fields = array(
"registration_ids" => "device id to send notification
",
"data" => $message
);
Upvotes: 0
Reputation: 387
Well, a stab in the dark of adding "title" fixed it. I wasn't able to find this documented at http://developer.android.com/google/gcm/server.html#params
{
"registration_ids" : ["..."],
"data" : {
"message" : "You received cash back!",
"title" : "Title"
}
}
Now in docs: https://developers.google.com/cloud-messaging/server#payload
Upvotes: 10