Prevent crash if NotificationManager throws an exception

This commit is contained in:
Sylvain Berfini 2023-05-11 16:55:30 +02:00
parent d14a62730a
commit 8397debb00

View file

@ -317,7 +317,11 @@ class NotificationsManager(private val context: Context) {
}
Log.i("[Notifications Manager] Notifying [$id] with tag [$tag]")
notificationManager.notify(tag, id, notification)
try {
notificationManager.notify(tag, id, notification)
} catch (iae: IllegalArgumentException) {
Log.e("[Notifications Manager] Exception occurred: $iae")
}
}
fun cancel(id: Int, tag: String? = null) {