Notification channel edits: improved names and changed default to low
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
@@ -899,18 +899,18 @@ class BaresipService: Service() {
|
|||||||
val caller = Utils.friendlyUri(this, peerUri, ua.account)
|
val caller = Utils.friendlyUri(this, peerUri, ua.account)
|
||||||
val person = Person.Builder().setName(caller).build()
|
val person = Person.Builder().setName(caller).build()
|
||||||
nb.setSmallIcon(R.drawable.ic_stat_call)
|
nb.setSmallIcon(R.drawable.ic_stat_call)
|
||||||
.setColor(ContextCompat.getColor(this, R.color.colorBaresip))
|
.setColor(ContextCompat.getColor(this, R.color.colorBaresip))
|
||||||
.setContentIntent(pi)
|
.setContentIntent(pi)
|
||||||
.setCategory(Notification.CATEGORY_CALL)
|
.setCategory(Notification.CATEGORY_CALL)
|
||||||
.setAutoCancel(false)
|
.setAutoCancel(false)
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
.setContentTitle(getString(R.string.incoming_call_from))
|
.setContentTitle(getString(R.string.incoming_call_from))
|
||||||
.setContentText(caller)
|
.setContentText(caller)
|
||||||
.setWhen(System.currentTimeMillis())
|
.setWhen(System.currentTimeMillis())
|
||||||
.setShowWhen(true)
|
.setShowWhen(true)
|
||||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||||
.setFullScreenIntent(pi, true)
|
.setFullScreenIntent(pi, true)
|
||||||
val answerIntent = Intent(applicationContext, MainActivity::class.java)
|
val answerIntent = Intent(applicationContext, MainActivity::class.java)
|
||||||
.putExtra("action", "call answer")
|
.putExtra("action", "call answer")
|
||||||
.putExtra("callp", callp)
|
.putExtra("callp", callp)
|
||||||
@@ -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"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user