From 6cc57a15f5375d0eff72de8093a36b39bd2f6468 Mon Sep 17 00:00:00 2001 From: "Roberto P. Rubio" Date: Tue, 26 Dec 2023 05:46:24 +0100 Subject: [PATCH] Adds a specific Notifications Channel to Connection Status Notifications --- .../nodomain/freeyourgadget/gadgetbridge/util/GB.java | 11 +++++++++-- app/src/main/res/values/strings.xml | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java index 12b5aa18c..e920204b2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java @@ -68,6 +68,7 @@ import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_REC public class GB { public static final String NOTIFICATION_CHANNEL_ID = "gadgetbridge"; + public static final String NOTIFICATION_CHANNEL_ID_CONNECTION_STATUS = "gadgetbridge connection status"; public static final String NOTIFICATION_CHANNEL_HIGH_PRIORITY_ID = "gadgetbridge_high_priority"; public static final String NOTIFICATION_CHANNEL_ID_TRANSFER = "gadgetbridge transfer"; public static final String NOTIFICATION_CHANNEL_ID_LOW_BATTERY = "low_battery"; @@ -115,6 +116,12 @@ public class GB { NotificationManager.IMPORTANCE_LOW); notificationManager.createNotificationChannel(channelGeneral); + NotificationChannel channelConnwectionStatus = new NotificationChannel( + NOTIFICATION_CHANNEL_ID_CONNECTION_STATUS, + context.getString(R.string.notification_channel_connection_status_name), + NotificationManager.IMPORTANCE_LOW); + notificationManager.createNotificationChannel(channelConnwectionStatus); + NotificationChannel channelHighPriority = new NotificationChannel( NOTIFICATION_CHANNEL_HIGH_PRIORITY_ID, context.getString(R.string.notification_channel_high_priority_name), @@ -154,7 +161,7 @@ public class GB { } public static Notification createNotification(List devices, Context context) { - NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID); + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID_CONNECTION_STATUS); if(devices.size() == 0){ builder.setContentTitle(context.getString(R.string.info_no_devices_connected)) .setSmallIcon(R.drawable.ic_notification_disconnected) @@ -258,7 +265,7 @@ public class GB { } public static Notification createNotification(String text, Context context) { - NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID); + NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID_CONNECTION_STATUS); builder.setTicker(text) .setContentText(text) .setSmallIcon(R.drawable.ic_notification_disconnected) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 207073c3f..1b25fb5cd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2494,4 +2494,5 @@ Whether the navigation app should automatically come to the foreground when it receives a navigation instruction Vibrate on new instruction Whether the watch should vibrate on every new or changed navigation instruction (only when the app is in the foreground) + Connection Status