]> gitweb.stoutner.com Git - PrivacyCell.git/blobdiff - app/src/main/java/com/stoutner/privacycell/services/RealtimeMonitoringService.kt
Disable swiping to dismiss realtime notifications. https://redmine.stoutner.com/issue...
[PrivacyCell.git] / app / src / main / java / com / stoutner / privacycell / services / RealtimeMonitoringService.kt
index 11af7b7fc357718638e46ee3cb4a976d07993361..19e1a3e2cede164c571b6dbc4558801bd5108979 100644 (file)
@@ -148,6 +148,9 @@ class RealtimeMonitoringService : Service() {
             // Set the color.
             notificationBuilder.setColor(getColor(R.color.red_notification_icon))
 
+            // Prevent swiping to dismiss the notification.
+            notificationBuilder.setOngoing(true)
+
             // Start the foreground notification.
             startForeground(NOTIFICATION_ID, notificationBuilder.build())
 
@@ -251,6 +254,9 @@ class RealtimeMonitoringService : Service() {
                 // Set the color.
                 antiquatedNetworkNotificationBuilder.setColor(getColor(R.color.red_notification_icon))
 
+                // Prevent swiping to dismiss the notification.
+                antiquatedNetworkNotificationBuilder.setOngoing(true)
+
                 // Update the notification.
                 notificationManager.notify(NOTIFICATION_ID, antiquatedNetworkNotificationBuilder.build())
 
@@ -275,6 +281,9 @@ class RealtimeMonitoringService : Service() {
                 // Set the color.
                 insecureNetworkNotificationBuilder.setColor(getColor(R.color.yellow_notification_icon))
 
+                // Prevent swiping to dismiss the notification.
+                insecureNetworkNotificationBuilder.setOngoing(true)
+
                 // Update the notification.
                 notificationManager.notify(NOTIFICATION_ID, insecureNetworkNotificationBuilder.build())
 
@@ -299,6 +308,9 @@ class RealtimeMonitoringService : Service() {
                 // Set the color.
                 secureNetworkNotificationBuilder.setColor(getColor(R.color.blue_icon))
 
+                // Prevent swiping to dismiss the notification.
+                secureNetworkNotificationBuilder.setOngoing(true)
+
                 // Update the notification.
                 notificationManager.notify(NOTIFICATION_ID, secureNetworkNotificationBuilder.build())