diff --git a/res/values/strings.xml b/res/values/strings.xml
index d6dfaa3b..9f8cd101 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -347,7 +347,8 @@
Control your phone\'s media players from another device
Other notifications
- Persistent indicator
+ Persistent indicator (no devices)
+ Persistent indicator (with devices)
Media control
File transfer
High priority
diff --git a/src/org/kde/kdeconnect/BackgroundService.java b/src/org/kde/kdeconnect/BackgroundService.java
index b9f3f2e2..7546401d 100644
--- a/src/org/kde/kdeconnect/BackgroundService.java
+++ b/src/org/kde/kdeconnect/BackgroundService.java
@@ -335,7 +335,13 @@ public class BackgroundService extends Service {
}
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
- NotificationCompat.Builder notification = new NotificationCompat.Builder(this, NotificationHelper.Channels.PERSISTENT);
+
+ NotificationCompat.Builder notification;
+ if (connectedDevices.isEmpty()) {
+ notification = new NotificationCompat.Builder(this, NotificationHelper.Channels.PERSISTENT_NO_DEVICES);
+ } else {
+ notification = new NotificationCompat.Builder(this, NotificationHelper.Channels.PERSISTENT_WITH_DEVICES);
+ }
notification
.setSmallIcon(R.drawable.ic_notification)
.setOngoing(true)
diff --git a/src/org/kde/kdeconnect/Helpers/NotificationHelper.java b/src/org/kde/kdeconnect/Helpers/NotificationHelper.java
index 6b5a62a9..57e56809 100644
--- a/src/org/kde/kdeconnect/Helpers/NotificationHelper.java
+++ b/src/org/kde/kdeconnect/Helpers/NotificationHelper.java
@@ -18,7 +18,8 @@ import java.util.List;
public class NotificationHelper {
public static class Channels {
- public final static String PERSISTENT = "persistent";
+ public final static String PERSISTENT_NO_DEVICES = "persistent_no_devices";
+ public final static String PERSISTENT_WITH_DEVICES = "persistent_with_devices";
public final static String DEFAULT = "default";
public final static String MEDIA_CONTROL = "media_control";
public final static String FILETRANSFER = "filetransfer";
@@ -46,9 +47,13 @@ public class NotificationHelper {
}
public static void initializeChannels(Context context) {
- final NotificationChannelCompat persistentChannel = new NotificationChannelCompat
- .Builder(Channels.PERSISTENT, NotificationManagerCompat.IMPORTANCE_MIN)
- .setName(context.getString(R.string.notification_channel_persistent))
+ final NotificationChannelCompat persistentChannelNoDevices = new NotificationChannelCompat
+ .Builder(Channels.PERSISTENT_NO_DEVICES, NotificationManagerCompat.IMPORTANCE_MIN)
+ .setName(context.getString(R.string.notification_channel_persistent_no_devices))
+ .build();
+ final NotificationChannelCompat persistentChannelWithDevices = new NotificationChannelCompat
+ .Builder(Channels.PERSISTENT_WITH_DEVICES, NotificationManagerCompat.IMPORTANCE_MIN)
+ .setName(context.getString(R.string.notification_channel_persistent_with_devices))
.build();
final NotificationChannelCompat defaultChannel = new NotificationChannelCompat
.Builder(Channels.DEFAULT, NotificationManagerCompat.IMPORTANCE_DEFAULT)
@@ -76,9 +81,9 @@ public class NotificationHelper {
.setName(context.getString(R.string.notification_channel_high_priority))
.build();
- final List channels = Arrays.asList(persistentChannel,
- defaultChannel, mediaChannel, fileTransferChannel, receiveNotificationChannel,
- smsMmsChannel, highPriorityChannel);
+ final List channels = Arrays.asList(persistentChannelNoDevices,
+ persistentChannelWithDevices, defaultChannel, mediaChannel, fileTransferChannel,
+ receiveNotificationChannel, smsMmsChannel, highPriorityChannel);
NotificationManagerCompat.from(context).createNotificationChannelsCompat(channels);
}