这是我目前的Android代码:
notification = new NotificationCompat.Builder(this);
notification.setContentTitle(notifyFromName);
notification.setContentText(notifyMsg);
if (!msgIsProj) {
String followText = notifyMsg + " you!";
notification.setContentText(followText);
notification.setGroup(GROUP_KEY_FOLLOWERS);
} else {
notification.setContentText(notifyMsg + " " + notifyItemName);
notification.setGroup(GROUP_KEY_PROJECTS);
}
notification.setTicker(getString(R.string.titlePushNotify));
notification.setSmallIcon(R.drawable.ic_pushnotify);
notification.setGroupSummary(true);
PendingIntent contentIntent = PendingIntent.getActivity(this, 1000,
newIntentMsg, PendingIntent.FLAG_CANCEL_CURRENT);
notification.setContentIntent(contentIntent);
notification.setAutoCancel(true);
manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notifyMsg != null && !notifyMsg.equals("")) {
manager.notify(0, notification.build());
}
正如您所看到的,我添加了setGroup
和setGroupSummary
- 但是,我在Android文档中也看到了我必须添加的摘要通知。有点困惑我如何做到这一点,如果是这样我如何调用addLine - 它从哪里拉信息? google docs
如果有人知道如何实现它,或者一个例子会很棒!