Android 8.0 双重通知音效
Android 8.0 Double Notification Sound
更新:我通过设置解决了
.setGroupAlertBehavior(GROUP_ALERT_SUMMARY)
我正在创建类似
的通知
new NotificationCompat.Builder(context, channel_id)
.setColor(..)
.setContentTitle(..)
.setSubText(..)
.setSmallIcon(..)
.setAutoCancel(true)
.setGroup(groupKey)
.setGroupSummary(true)
.setContentIntent(resultPendingIntent)
.build();
在 8.0 上,某些设备会看到每个通知都有双重通知声音。 There is a blog post around this
有些应用似乎找到了解决问题的方法?求助!
由于在androidO中引入了新的"Notification channels",您需要创建通知渠道并设置NotificationManager.IMPORTANCE_LOW
。
勾选
.setGroupAlertBehavior(GROUP_ALERT_SUMMARY)
您需要定义notifications Group。
然后,您需要设置 setGroupAlertBehavior,如@Anand Khinvasara 的回答
notificationBuilder.setGroup("com.YOUR_PACKAGE_ID.NOTIFICATIONS_GROUP");
notificationBuilder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY);
更新:我通过设置解决了
.setGroupAlertBehavior(GROUP_ALERT_SUMMARY)
我正在创建类似
的通知new NotificationCompat.Builder(context, channel_id)
.setColor(..)
.setContentTitle(..)
.setSubText(..)
.setSmallIcon(..)
.setAutoCancel(true)
.setGroup(groupKey)
.setGroupSummary(true)
.setContentIntent(resultPendingIntent)
.build();
在 8.0 上,某些设备会看到每个通知都有双重通知声音。 There is a blog post around this
有些应用似乎找到了解决问题的方法?求助!
由于在androidO中引入了新的"Notification channels",您需要创建通知渠道并设置NotificationManager.IMPORTANCE_LOW
。
勾选
.setGroupAlertBehavior(GROUP_ALERT_SUMMARY)
您需要定义notifications Group。 然后,您需要设置 setGroupAlertBehavior,如@Anand Khinvasara 的回答
notificationBuilder.setGroup("com.YOUR_PACKAGE_ID.NOTIFICATIONS_GROUP");
notificationBuilder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY);