mirror of
https://github.com/home-assistant/android
synced 2024-07-23 19:34:23 +00:00
Prevent crash when removing default channel (#1405)
This commit is contained in:
parent
94a86de4d5
commit
6109ce466c
|
@ -166,7 +166,7 @@ class MessagingService : FirebaseMessagingService() {
|
|||
clearNotification(it["tag"]!!)
|
||||
}
|
||||
it[MESSAGE] == REMOVE_CHANNEL && !it["channel"].isNullOrBlank() -> {
|
||||
Log.d(TAG, "Removing Notification channel ${it["tag"]}")
|
||||
Log.d(TAG, "Removing Notification channel ${it["channel"]}")
|
||||
removeNotificationChannel(it["channel"]!!)
|
||||
}
|
||||
it[MESSAGE] == TTS -> {
|
||||
|
@ -301,7 +301,7 @@ class MessagingService : FirebaseMessagingService() {
|
|||
|
||||
val channelID: String = createChannelID(channelName)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && channelID != NotificationChannel.DEFAULT_CHANNEL_ID) {
|
||||
notificationManagerCompat.deleteNotificationChannel(channelID)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue