我试图对我的通知进行分组,但显然他们会分开来。
NotificationManager mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
Intent resultIntent = new Intent(this, SplashScreenBaseActivity.class);
resultIntent.putExtra(Arguments.ARG_NOTIFICATION_TYPE, NEWS_TYPE);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_UPDATE_CURRENT
);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher_small)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
.setContentTitle(contentTitle)
.setContentText(contentText)
.setAutoCancel(true)
.setGroup(NEWS_GROUP)
.setGroupSummary(true)
.setDefaults(-1);
mBuilder.setContentIntent(resultPendingIntent);
Random random = new Random();
NOTIFICATION_ID = random.nextInt(9999 - 1000) + 1000;
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());