diff --git a/app/build.gradle b/app/build.gradle
index 731c1d82b..8599545bc 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -168,8 +168,8 @@ dependencies {
implementation 'androidx.media:media:1.2.0'
implementation 'androidx.fragment:fragment-ktx:1.2.5'
implementation 'androidx.core:core-ktx:1.3.2'
- implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
- implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
+ implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
+ implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
diff --git a/app/src/main/java/org/linphone/compatibility/Api26Compatibility.kt b/app/src/main/java/org/linphone/compatibility/Api26Compatibility.kt
index 15acd0b31..8c7346053 100644
--- a/app/src/main/java/org/linphone/compatibility/Api26Compatibility.kt
+++ b/app/src/main/java/org/linphone/compatibility/Api26Compatibility.kt
@@ -52,12 +52,9 @@ class Api26Compatibility {
fun createServiceChannel(context: Context, notificationManager: NotificationManagerCompat) {
// Create service notification channel
val id = context.getString(R.string.notification_channel_service_id)
- val name: CharSequence =
- context.getString(R.string.notification_channel_service_name)
- val description =
- context.getString(R.string.notification_channel_service_name)
- val channel =
- NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW)
+ val name = context.getString(R.string.notification_channel_service_name)
+ val description = context.getString(R.string.notification_channel_service_name)
+ val channel = NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW)
channel.description = description
channel.enableVibration(false)
channel.enableLights(false)
@@ -65,18 +62,31 @@ class Api26Compatibility {
notificationManager.createNotificationChannel(channel)
}
+ fun createMissedCallChannel(
+ context: Context,
+ notificationManager: NotificationManagerCompat
+ ) {
+ val id = context.getString(R.string.notification_channel_missed_call_id)
+ val name = context.getString(R.string.notification_channel_missed_call_name)
+ val description = context.getString(R.string.notification_channel_missed_call_name)
+ val channel = NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW)
+ channel.description = description
+ channel.lightColor = context.getColor(R.color.notification_led_color)
+ channel.enableVibration(true)
+ channel.enableLights(true)
+ channel.setShowBadge(true)
+ notificationManager.createNotificationChannel(channel)
+ }
+
fun createIncomingCallChannel(
context: Context,
notificationManager: NotificationManagerCompat
) {
// Create incoming calls notification channel
val id = context.getString(R.string.notification_channel_incoming_call_id)
- val name: CharSequence =
- context.getString(R.string.notification_channel_incoming_call_name)
- val description =
- context.getString(R.string.notification_channel_incoming_call_name)
- val channel =
- NotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH)
+ val name = context.getString(R.string.notification_channel_incoming_call_name)
+ val description = context.getString(R.string.notification_channel_incoming_call_name)
+ val channel = NotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH)
channel.description = description
channel.lightColor = context.getColor(R.color.notification_led_color)
channel.enableVibration(true)
@@ -85,13 +95,15 @@ class Api26Compatibility {
notificationManager.createNotificationChannel(channel)
}
- fun createMessageChannel(context: Context, notificationManager: NotificationManagerCompat) {
+ fun createMessageChannel(
+ context: Context,
+ notificationManager: NotificationManagerCompat
+ ) {
// Create messages notification channel
val id = context.getString(R.string.notification_channel_chat_id)
val name = context.getString(R.string.notification_channel_chat_name)
val description = context.getString(R.string.notification_channel_chat_name)
- val channel =
- NotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH)
+ val channel = NotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH)
channel.description = description
channel.lightColor = context.getColor(R.color.notification_led_color)
channel.enableLights(true)
diff --git a/app/src/main/java/org/linphone/compatibility/Compatibility.kt b/app/src/main/java/org/linphone/compatibility/Compatibility.kt
index cf83f6ac8..38d464255 100644
--- a/app/src/main/java/org/linphone/compatibility/Compatibility.kt
+++ b/app/src/main/java/org/linphone/compatibility/Compatibility.kt
@@ -80,6 +80,7 @@ class Compatibility {
) {
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
Api26Compatibility.createServiceChannel(context, notificationManager)
+ Api26Compatibility.createMissedCallChannel(context, notificationManager)
Api26Compatibility.createIncomingCallChannel(context, notificationManager)
Api26Compatibility.createMessageChannel(context, notificationManager)
}
diff --git a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt
index 68acc8fb1..754a31676 100644
--- a/app/src/main/java/org/linphone/notifications/NotificationsManager.kt
+++ b/app/src/main/java/org/linphone/notifications/NotificationsManager.kt
@@ -320,7 +320,7 @@ class NotificationsManager(private val context: Context) {
.setContentText(if (useAutoStartDescription) context.getString(R.string.service_auto_start_description) else context.getString(R.string.service_description))
.setSmallIcon(R.drawable.topbar_service_notification)
.setContentIntent(pendingIntent)
- .setCategory(Notification.CATEGORY_SERVICE)
+ .setCategory(NotificationCompat.CATEGORY_SERVICE)
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
.setWhen(System.currentTimeMillis())
.setShowWhen(true)
@@ -419,13 +419,13 @@ class NotificationsManager(private val context: Context) {
.createPendingIntent()
val notification = NotificationCompat.Builder(
- context, context.getString(R.string.notification_channel_incoming_call_id))
+ context, context.getString(R.string.notification_channel_missed_call_id))
.setContentTitle(context.getString(R.string.missed_call_notification_title))
.setContentText(body)
.setSmallIcon(R.drawable.topbar_missed_call_notification)
.setAutoCancel(true)
.setContentIntent(pendingIntent)
- .setCategory(Notification.CATEGORY_EVENT)
+ // .setCategory(NotificationCompat.CATEGORY_EVENT) No one really matches "missed call"
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
.setWhen(System.currentTimeMillis())
.setShowWhen(true)
@@ -488,7 +488,7 @@ class NotificationsManager(private val context: Context) {
.setLargeIcon(roundPicture)
.setAutoCancel(false)
.setContentIntent(pendingIntent)
- .setCategory(Notification.CATEGORY_CALL)
+ .setCategory(NotificationCompat.CATEGORY_CALL)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setPriority(NotificationCompat.PRIORITY_LOW)
.setWhen(System.currentTimeMillis())
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index be84f0474..61ea700f7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -542,9 +542,11 @@
linphone_notification_service_id
+ linphone_notification_missed_call_id
linphone_notification_call_id
linphone_notification_chat_id
&appName; service notification
+ &appName; missed calls notifications
&appName; incoming calls notifications
&appName; instant messages notifications
Call incoming
diff --git a/build.gradle b/build.gradle
index 5686a006c..93040a295 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.4.20'
+ ext.kotlin_version = '1.4.21'
repositories {
google()