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.
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
Have a look at the documentation here:
{
"registration_ids" : ["..."],
"notification" : {
"body" : "You received cash back!",
"title" : "Title",
"icon": "ic_notification" // replace with your own
}
}
its working my side
$message = array("message" => $pushMessage,"title" => "My Notification");
$fields = array(
"registration_ids" => "device id to send notification
",
"data" => $message
);