diff --git a/tools/chatgui-android/app/src/main/java/com/utun/chat/data/CallService.kt b/tools/chatgui-android/app/src/main/java/com/utun/chat/data/CallService.kt index cbcc85cd..18dd7266 100644 --- a/tools/chatgui-android/app/src/main/java/com/utun/chat/data/CallService.kt +++ b/tools/chatgui-android/app/src/main/java/com/utun/chat/data/CallService.kt @@ -66,7 +66,7 @@ class CallService : Service() { } private fun createChannel() { - val manager = getSystemService(NotificationManager::class.java) + val manager = requireNotNull(getSystemService(NotificationManager::class.java)) { "notification manager unavailable" } manager.createNotificationChannel( NotificationChannel(CHANNEL, AppLanguage.text(R.string.ongoing_call), NotificationManager.IMPORTANCE_DEFAULT).apply { description = AppLanguage.text(R.string.ongoing_call_description) @@ -77,7 +77,7 @@ class CallService : Service() { val channel = manager.getNotificationChannel(CHANNEL) LogManager.addLog("INFO", "CallService", "notification channel=$CHANNEL enabled=${manager.areNotificationsEnabled()} " + - "importance=${channel.importance} lockscreenVisibility=${channel.lockscreenVisibility}") + "importance=${channel?.importance} lockscreenVisibility=${channel?.lockscreenVisibility}") } fun refreshLanguage() { createChannel(); updateNotification() } @@ -164,7 +164,8 @@ class CallService : Service() { } fun updateNotification() { - getSystemService(NotificationManager::class.java).notify(NOTIFICATION_ID, notification()) + requireNotNull(getSystemService(NotificationManager::class.java)) { "notification manager unavailable" } + .notify(NOTIFICATION_ID, notification()) LogManager.addLog("INFO", "CallService", "notification updated id=$callId phase=${CallController.state.value?.phase}") }