Reputation: 703
My question is how to configure the notification, ie to have a title and a message, because it only gets me the message but no title. in file "GCMIntentService.java" plugin I found three variables, title, message and msgcnt, could tell me how each is used and that it serves?
Here the data are received bad about that uses a default value
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context)
.setDefaults(Notification.DEFAULT_ALL)
.setSmallIcon(context.getApplicationInfo().icon)
.setWhen(System.currentTimeMillis())
.setContentTitle(extras.getString("title"))
.setTicker(extras.getString("title"))
.setContentIntent(contentIntent);
String message = extras.getString("message");
if (message != null) {
mBuilder.setContentText(message);
} else {
mBuilder.setContentText("<missing message content>");
}
Upvotes: 1
Views: 273
Reputation: 4579
Your php should looks like this.
$fields = array(
'registration_ids' => $regs_ids,
'data' => array( "message" => $message, "title" => $title ),
);
Passing the parameter title in the array should works.
Upvotes: 1