【发布时间】:2013-09-23 12:07:30
【问题描述】:
我使用 GCM(Google Cloud Message) 进行推送通知。
当通知到达设备时它看起来像这样:
Received: Bundle[{message=hello, android.support.content.wakelockid=2,
collapse_key=do_not_collapse, from=243316392621}]
现在我想提取消息和wakelockId,以便只在通知上显示消息。(在这个例子中只有你好)
我的 notificationBuider 如下:
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(com.example.example.R.drawable.icon)
.setContentTitle("Example")
.setDefaults(Notification.DEFAULT_ALL)
.setAutoCancel(true)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(msg))
.setContentText(msg);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
请在这方面指导我。任何帮助将不胜感激。
【问题讨论】:
标签: notifications push-notification google-cloud-messaging android-notifications