我已经合并了 GCM 通知,但它会覆盖现有的,然后根据
中给出的建议this link我使用并得到了它,但它正在更新为多个通知,需要像这个图像一样实现 -
在这里我无法在多行中实现这种类型。我正在尝试 BigNotify不使用样式和扩展,但我需要按照 Summarize notification guide 中声明的那样堆叠通知
至少我正在尝试从 3 次聊天中获得 5 条消息作为通知的总结,是否有任何解决方法?
最佳答案
我得到了答案,试过this
`
public static void pushNotification(Activity currentActivity, String title, String content[]){
NotificationManager nm = (NotificationManager) currentActivity.getSystemService(Context.NOTIFICATION_SERVICE);
Intent resultIntent = new Intent(currentActivity.getBaseContext(), FileSharingActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(currentActivity);
stackBuilder.addParentStack(FileSharingActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0,PendingIntent.FLAG_UPDATE_CURRENT);
nm.notify(nextId++, new Notification.InboxStyle(new Notification.Builder(currentActivity.getBaseContext())
.setTicker("Ticker")
.setSmallIcon(R.drawable.ic_launcher)
.setWhen(System.currentTimeMillis())
.setContentTitle("Content title")
.setContentText("Content text")
.setNumber(4)
.setContentIntent(resultPendingIntent))
.addLine("First Message")
.addLine("Second Message")
.addLine("Third Message")
.addLine("Fourth Message")
.setBigContentTitle("Here Your Messages")
.setSummaryText("+3 more")
.build());
}
`
关于android - 接收不同标准的多个推送通知并根据该标准更新通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33781263/