我的群组通知运行正常,但是,我注意到在几个小时后(当一段时间不使用设备时)收到新通知时,扩展通知时消息内容消失了。我知道这不是请求代码问题,因为所有请求代码都是唯一的,并且我能够像往常一样回复通知。 要注意的一件事是,通知 下面是描述行为的图片快照: 第一个通知 第二条通知进来了。 扩展两个通知,因为您会看到它们的所有消息都消失了。 代码:请注意,我只发送一次摘要通知。contentText
消失之后,出现的下一个通知(如果设备处于活动状态(不一定是应用程序)),则该通知在展开时将显示其正常文本。这似乎仅在一段时间不使用设备AND / OR应用程序时才会发生。这是一个android系统问题吗?
// Normal notification
int uniqueRequestCode = RandomUser.getUniqueRequestCode();
PendingIntent pendingIntent = PendingIntent.getActivity(
this, uniqueRequestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Notificatio notification = new NotificationCompat.Builder(getApplicationContext(), MESSAGE_CHANNEL_ID)
.setSmallIcon(R.drawable.ne1_white_logo_crop)
.setContentTitle(title)
.setContentText(body)
.setStyle(new NotificationCompat.BigTextStyle().bigText(body))
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
// Set the intent that will fire when the user taps the notification
.setContentIntent(pendingIntent)
.addAction(action)
.setGroup(GROUP_KEY_MESSAGE)
//.setGroupAlertBehavior(groupAlert)
.setColor(Color.BLACK)
.setAutoCancel(true)
.build();
// Summary notification
uniqueRequestCode = RandomUser.getUniqueRequestCode();
PendingIntent pendingIntent = PendingIntent.getActivity(
this, uniqueRequestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification summaryNotification = new NotificationCompat.Builder(this, MESSAGE_CHANNEL_ID)
.setSmallIcon(R.drawable.ne1_white_logo_crop)
// Specify which group this notification belongs to
.setGroup(GROUP_KEY_MESSAGE)
// Set this notification as the summary for the group
.setGroupSummary(true)
.setContentIntent(pendingIntent)
.build();
0 个答案:
没有答案