From 0e58358287daaada53e610b5e512b0a6de9771bd Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 8 Jan 2019 15:56:48 +0100 Subject: [PATCH] delete notification channels only on Android Oreo --- .../simplemobiletools/calendar/pro/extensions/Context.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt index 86ec964cc..2b58fe3db 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/extensions/Context.kt @@ -214,8 +214,10 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content: // create a new channel for every new sound uri as the new Android Oreo notification system is fundamentally broken if (soundUri != config.lastSoundUri || config.lastVibrateOnReminder != config.vibrateOnReminder) { if (!publicVersion) { - val oldChannelId = "simple_calendar_${config.lastReminderChannel}_${config.reminderAudioStream}" - notificationManager.deleteNotificationChannel(oldChannelId) + if (isOreoPlus()) { + val oldChannelId = "simple_calendar_${config.lastReminderChannel}_${config.reminderAudioStream}" + notificationManager.deleteNotificationChannel(oldChannelId) + } } config.lastVibrateOnReminder = config.vibrateOnReminder