Add dedicated notification channel for missed calls
This commit is contained in:
parent
cbe2d434ae
commit
5b8aeacd86
4 changed files with 22 additions and 2 deletions
|
@ -107,6 +107,23 @@ class ApiTwentySixPlus {
|
|||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
|
||||
public static void createMissedCallChannel(Context context) {
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
// Create missed call notification channel
|
||||
String id = context.getString(R.string.notification_missed_call_channel_id);
|
||||
String name = context.getString(R.string.content_title_notification_missed_call);
|
||||
String description = context.getString(R.string.content_title_notification_missed_call);
|
||||
NotificationChannel channel =
|
||||
new NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW);
|
||||
channel.setDescription(description);
|
||||
channel.setLightColor(context.getColor(R.color.notification_led_color));
|
||||
channel.enableLights(true);
|
||||
channel.enableVibration(true);
|
||||
channel.setShowBadge(true);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
|
||||
public static Notification createMessageNotification(
|
||||
Context context, Notifiable notif, Bitmap contactIcon, PendingIntent intent) {
|
||||
|
||||
|
@ -262,14 +279,14 @@ class ApiTwentySixPlus {
|
|||
public static Notification createMissedCallNotification(
|
||||
Context context, String title, String text, PendingIntent intent, int count) {
|
||||
return new Notification.Builder(
|
||||
context, context.getString(R.string.notification_channel_id))
|
||||
context, context.getString(R.string.notification_missed_call_channel_id))
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.call_status_missed)
|
||||
.setAutoCancel(true)
|
||||
.setContentIntent(intent)
|
||||
.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE)
|
||||
.setCategory(Notification.CATEGORY_EVENT)
|
||||
//.setCategory(Notification.CATEGORY_EVENT) No one really matches "missed call"
|
||||
.setVisibility(Notification.VISIBILITY_PRIVATE)
|
||||
.setPriority(Notification.PRIORITY_HIGH)
|
||||
.setWhen(System.currentTimeMillis())
|
||||
|
|
|
@ -71,6 +71,7 @@ public class Compatibility {
|
|||
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
|
||||
ApiTwentySixPlus.createServiceChannel(context);
|
||||
ApiTwentySixPlus.createMessageChannel(context);
|
||||
ApiTwentySixPlus.createMissedCallChannel(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<string name="about_bugreport_email" translatable="false">linphone-android@belledonne-communications.com</string>
|
||||
<string name="notification_service_channel_id" translatable="false">linphone_notification_service_id</string>
|
||||
<string name="notification_channel_id" translatable="false">linphone_notification_id</string>
|
||||
<string name="notification_missed_call_channel_id" translatable="false">linphone_notification_missed_call_id</string>
|
||||
|
||||
<!-- Push notification settings -->
|
||||
<bool name="enable_push_id">true</bool>
|
||||
|
|
|
@ -644,6 +644,7 @@
|
|||
<string name="content_description_exit_conference">Exit conference</string>
|
||||
<string name="content_title_notification_service">Linphone service notification</string>
|
||||
<string name="content_title_notification">Linphone instant messages notifications</string>
|
||||
<string name="content_title_notification_missed_call">Linphone missed calls notifications</string>
|
||||
<string name="content_description_conversation_subject">Group chat room subject</string>
|
||||
<string name="content_description_conversation_infos">Group chat room info</string>
|
||||
<string name="content_description_record_call">Record call</string>
|
||||
|
|
Loading…
Reference in a new issue