]> gitweb.stoutner.com Git - PrivacyCell.git/blobdiff - app/src/main/java/com/stoutner/privacycell/services/RealtimeMonitoringService.kt
Suppress the sound for unknown network notifications. https://redmine.stoutner.com...
[PrivacyCell.git] / app / src / main / java / com / stoutner / privacycell / services / RealtimeMonitoringService.kt
index dc5b49483425cc043c238790452d5d48c4899259..663c178016e701f2ea4650feb72745cc93b53dad 100644 (file)
@@ -44,6 +44,7 @@ class RealtimeMonitoringService : Service() {
         // Define the public constants.
         const val SECURE_NETWORK = "secure_network"
         const val INSECURE_NETWORK = "insecure_network"
         // Define the public constants.
         const val SECURE_NETWORK = "secure_network"
         const val INSECURE_NETWORK = "insecure_network"
+        const val UNKNOWN_NETWORK = "unknown_network"
     }
 
     override fun onBind(intent: Intent?): IBinder? {
     }
 
     override fun onBind(intent: Intent?): IBinder? {
@@ -61,25 +62,29 @@ class RealtimeMonitoringService : Service() {
         // Prepare the notification channels.
         val secureNetworkChannel = NotificationChannel(SECURE_NETWORK, getString(R.string.secure_network_channel), NotificationManager.IMPORTANCE_DEFAULT)
         val insecureNetworkChannel = NotificationChannel(INSECURE_NETWORK, getString(R.string.insecure_network_channel), NotificationManager.IMPORTANCE_DEFAULT)
         // Prepare the notification channels.
         val secureNetworkChannel = NotificationChannel(SECURE_NETWORK, getString(R.string.secure_network_channel), NotificationManager.IMPORTANCE_DEFAULT)
         val insecureNetworkChannel = NotificationChannel(INSECURE_NETWORK, getString(R.string.insecure_network_channel), NotificationManager.IMPORTANCE_DEFAULT)
+        val unknownNetworkChannel = NotificationChannel(UNKNOWN_NETWORK, getString(R.string.unknown_network_channel), NotificationManager.IMPORTANCE_LOW)
 
         // Set the notification channel group.
         secureNetworkChannel.group = REALTIME_MONITORING
         insecureNetworkChannel.group = REALTIME_MONITORING
 
         // Set the notification channel group.
         secureNetworkChannel.group = REALTIME_MONITORING
         insecureNetworkChannel.group = REALTIME_MONITORING
+        unknownNetworkChannel.group = REALTIME_MONITORING
 
         // Disable the notification dots.
         secureNetworkChannel.setShowBadge(false)
         insecureNetworkChannel.setShowBadge(false)
 
         // Disable the notification dots.
         secureNetworkChannel.setShowBadge(false)
         insecureNetworkChannel.setShowBadge(false)
+        unknownNetworkChannel.setShowBadge(false)
 
 
-        // Set the notifications to be public.
+        // Set the notifications to be public for the secure and insecure networks.
         secureNetworkChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
         insecureNetworkChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
 
         // Create the notification channels.
         notificationManager.createNotificationChannel(secureNetworkChannel)
         notificationManager.createNotificationChannel(insecureNetworkChannel)
         secureNetworkChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
         insecureNetworkChannel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
 
         // Create the notification channels.
         notificationManager.createNotificationChannel(secureNetworkChannel)
         notificationManager.createNotificationChannel(insecureNetworkChannel)
+        notificationManager.createNotificationChannel(unknownNetworkChannel)
 
         // Create a notification builder.
 
         // Create a notification builder.
-        val notificationBuilder = Notification.Builder(this, INSECURE_NETWORK)
+        val notificationBuilder = Notification.Builder(this, UNKNOWN_NETWORK)
 
         // Create an intent to open Privacy Cell.
         val privacyCellIntent = Intent(this, PrivacyCellActivity::class.java)
 
         // Create an intent to open Privacy Cell.
         val privacyCellIntent = Intent(this, PrivacyCellActivity::class.java)