diff --git a/tools/chatgui-android/app/src/main/java/com/utun/chat/data/RadioOverlayService.kt b/tools/chatgui-android/app/src/main/java/com/utun/chat/data/RadioOverlayService.kt index aaabaf533..7a4c4eafc 100644 --- a/tools/chatgui-android/app/src/main/java/com/utun/chat/data/RadioOverlayService.kt +++ b/tools/chatgui-android/app/src/main/java/com/utun/chat/data/RadioOverlayService.kt @@ -59,7 +59,8 @@ class RadioOverlayService : Service() { fun refreshLanguage() { currentService?.let { service -> service.createChannel() - service.getSystemService(NotificationManager::class.java).notify(NOTIF_ID, service.buildNotification()) + requireNotNull(service.getSystemService(NotificationManager::class.java)) { "notification manager unavailable" } + .notify(NOTIF_ID, service.buildNotification()) } } @@ -301,7 +302,7 @@ class RadioOverlayService : Service() { val ch = NotificationChannel(CHANNEL_ID, AppLanguage.text(R.string.radio_ptt), NotificationManager.IMPORTANCE_LOW).apply { description = AppLanguage.text(R.string.radio_overlay_description) } - getSystemService(NotificationManager::class.java).createNotificationChannel(ch) + requireNotNull(getSystemService(NotificationManager::class.java)) { "notification manager unavailable" }.createNotificationChannel(ch) } }