diff --git a/app/src/main/java/com/ivy/wallet/android/notification/NotificationService.kt b/app/src/main/java/com/ivy/wallet/android/notification/NotificationService.kt index e81623e5d8..4e8eaf38b0 100644 --- a/app/src/main/java/com/ivy/wallet/android/notification/NotificationService.kt +++ b/app/src/main/java/com/ivy/wallet/android/notification/NotificationService.kt @@ -32,14 +32,18 @@ class NotificationService( notification: NotificationCompat.Builder, notificationId: Int ) { - val notificationManager = - context.getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager - ?: return - // Register the channel with the system - val channel = (notification as IvyNotification).ivyChannel.create(context) + try { + val notificationManager = + context.getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager + ?: return + // Register the channel with the system + val channel = (notification as IvyNotification).ivyChannel.create(context) - notificationManager.createNotificationChannel(channel) - notificationManager.notify(notificationId, notification.build()) + notificationManager.createNotificationChannel(channel) + notificationManager.notify(notificationId, notification.build()) + } catch (e: Exception) { + e.printStackTrace() + } } fun dismissNotification(notificationId: Int) {