mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
fix #487, allow playing notification sound in DND on Android OREO too
This commit is contained in:
@@ -192,9 +192,9 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
|
|||||||
val channelId = "my_reminder_channel_$soundUri"
|
val channelId = "my_reminder_channel_$soundUri"
|
||||||
if (isOreoPlus()) {
|
if (isOreoPlus()) {
|
||||||
val audioAttributes = AudioAttributes.Builder()
|
val audioAttributes = AudioAttributes.Builder()
|
||||||
.setUsage(AudioAttributes.USAGE_NOTIFICATION)
|
.setUsage(AudioAttributes.USAGE_ALARM)
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||||
.setLegacyStreamType(AudioManager.STREAM_NOTIFICATION)
|
.setLegacyStreamType(AudioManager.STREAM_ALARM)
|
||||||
.setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED)
|
.setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@@ -202,6 +202,7 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
|
|||||||
val name = resources.getString(R.string.event_reminders)
|
val name = resources.getString(R.string.event_reminders)
|
||||||
val importance = NotificationManager.IMPORTANCE_HIGH
|
val importance = NotificationManager.IMPORTANCE_HIGH
|
||||||
NotificationChannel(channelId, name, importance).apply {
|
NotificationChannel(channelId, name, importance).apply {
|
||||||
|
setBypassDnd(true)
|
||||||
enableLights(true)
|
enableLights(true)
|
||||||
lightColor = event.color
|
lightColor = event.color
|
||||||
enableVibration(false)
|
enableVibration(false)
|
||||||
|
Reference in New Issue
Block a user