Notification channel edits: improved names and changed default to low

This commit is contained in:
Juha Heinanen
2025-07-06 14:27:14 +03:00
parent d17f2d8029
commit 14d9122693
2 changed files with 21 additions and 19 deletions
@@ -138,7 +138,7 @@ class BaresipService: Service() {
nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
createNotificationChannels() createNotificationChannels()
snb = NotificationCompat.Builder(this, DEFAULT_CHANNEL_ID) snb = NotificationCompat.Builder(this, LOW_CHANNEL_ID)
pm = getSystemService(POWER_SERVICE) as PowerManager pm = getSystemService(POWER_SERVICE) as PowerManager
@@ -1291,16 +1291,18 @@ class BaresipService: Service() {
} }
private fun createNotificationChannels() { private fun createNotificationChannels() {
val defaultChannel = NotificationChannel(DEFAULT_CHANNEL_ID, "Default", val lowChannel = NotificationChannel(LOW_CHANNEL_ID, "No sound or vibrate",
NotificationManager.IMPORTANCE_LOW) NotificationManager.IMPORTANCE_LOW)
defaultChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC lowChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
nm.createNotificationChannel(defaultChannel) nm.createNotificationChannel(lowChannel)
val highChannel = NotificationChannel(HIGH_CHANNEL_ID, "High",
val highChannel = NotificationChannel(HIGH_CHANNEL_ID, "Sound and vibrate",
NotificationManager.IMPORTANCE_HIGH) NotificationManager.IMPORTANCE_HIGH)
highChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC highChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
highChannel.enableVibration(true) highChannel.enableVibration(true)
nm.createNotificationChannel(highChannel) nm.createNotificationChannel(highChannel)
val mediumChannel = NotificationChannel(MEDIUM_CHANNEL_ID, "Medium",
val mediumChannel = NotificationChannel(MEDIUM_CHANNEL_ID, "Sound",
NotificationManager.IMPORTANCE_HIGH) NotificationManager.IMPORTANCE_HIGH)
highChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC highChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
highChannel.enableVibration(false) highChannel.enableVibration(false)
@@ -2,7 +2,7 @@ package com.tutpro.baresip
const val TAG = "Baresip" const val TAG = "Baresip"
const val DEFAULT_CHANNEL_ID = "com.tutpro.baresip.default" const val LOW_CHANNEL_ID = "com.tutpro.baresip.low"
const val MEDIUM_CHANNEL_ID = "com.tutpro.baresip.medium" const val MEDIUM_CHANNEL_ID = "com.tutpro.baresip.medium"
const val HIGH_CHANNEL_ID = "com.tutpro.baresip.high" const val HIGH_CHANNEL_ID = "com.tutpro.baresip.high"