Android 是否可以将操作添加到捆绑通知的摘要中?
我正在使用捆绑通知按类型对通知进行分组。从用户的角度来看,当通知最大化时,这一点非常有效,如下所示: 但是,当子通知在摘要中折叠时,这并不太有效: 现在,鉴于可以对该组中的所有通知执行相同的Android 是否可以将操作添加到捆绑通知的摘要中?,android,push-notification,android-7.0-nougat,Android,Push Notification,Android 7.0 Nougat,我正在使用捆绑通知按类型对通知进行分组。从用户的角度来看,当通知最大化时,这一点非常有效,如下所示: 但是,当子通知在摘要中折叠时,这并不太有效: 现在,鉴于可以对该组中的所有通知执行相同的REGISTER操作,我想让用户只需点击摘要通知中的REGISTER all操作即可执行所有这些操作。然而,向摘要中添加操作似乎没有效果。下面的代码(我目前正在使用的代码)显示,对摘要通知的操作被忽略: final PendingIntent actionIntent = PendingIntent.ge
REGISTER
操作,我想让用户只需点击摘要通知中的REGISTER all
操作即可执行所有这些操作。然而,向摘要中添加操作似乎没有效果。下面的代码(我目前正在使用的代码)显示,对摘要通知的操作被忽略:
final PendingIntent actionIntent = PendingIntent.getService(this, 0, RegisterAllService.getRegisterAllServiceIntent(),PendingIntent.FLAG_UPDATE_CURRENT);
final NotificationCompat.Action action = new NotificationCompat.Action(R.mipmap.ic_launcher, "register all", actionIntent);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_notification)
.setAutoCancel(true)
.addAction(action)
.setGroup("confirmgroup")
.setGroupSummary(true);
NotificationManagerCompat.from(getApplicationContext()).notify(0, builder.build());
for(MyNotification myNotification: myNotifications){
final PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
final PendingIntent actionIntent = PendingIntent.getService(this, 0, RegisterService.getRegisterServiceIntent(),PendingIntent.FLAG_UPDATE_CURRENT);
final NotificationCompat.Action action = new NotificationCompat.Action(R.mipmap.ic_launcher, "register", actionIntent);
NotificationCompat.Builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_notification)
.setContentTitle(myNotification.getTitle())
.setStyle(new NotificationCompat.BigTextStyle().bigText(myNotification.getSubtitle()))
.setTicker(myNotification.getSubtitle())
.setContentText(myNotification.getSubtitle())
.setAutoCancel(true)
.addAction(action)
.setGroup("confirmgroup")
.setGroupSummary(false)
.setContentIntent(pendingIntent)
NotificationManagerCompat.from(getApplicationContext()).notify(myNotification.getId(), builder.build());
}
有没有办法做到这一点?你找到解决办法了吗?不幸的是,我没有。该功能被搁置,因为它不值得努力。现在,您找到解决方案了吗?