implementation 'androidx.work:work-runtime-ktx:2.7.1'
 
     // Include the Kotlin standard library.  This should be the same version number listed in the project build.gradle.
-    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21'
+    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.0'
 
     // Include the Google material library.
     implementation 'com.google.android.material:material:1.6.1'
 
     </head>
 
     <body>
-        <h3>1.8 (Version Code 9)</h3>
-        <p>14. Juni 2022 - Mindest-API 30, Ziel-API 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (Version Code 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14. Juni 2022</a> - Mindest-API 30, Ziel-API 32</p>
         <ul>
             <li>Der <a href="https://redmine.stoutner.com/issues/851">Sprach-Netzwerk-Status</a> wird nun bei der Einschätzung der Gesamt-Sicherheit des Funknetzwerks berücksichtigt.</li>
             <li>Fehler behoben, durch den gelegentlich <a href="https://redmine.stoutner.com/issues/850">Benachrichtigungen nicht abgeschaltet werden konnten</a>.</li>
 
     </head>
 
     <body>
-        <h3>1.8 (version code 9)</h3>
-        <p>14 June 2022 - minimum API 30, target API 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (version code 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 June 2022</a> - minimum API 30, target API 32</p>
         <ul>
             <li>Include the <a href="https://redmine.stoutner.com/issues/851">voice network status</a> in determining the overall security of the cell network.</li>
             <li>Fix a bug that sometimes <a href="https://redmine.stoutner.com/issues/850">prevented notifications from being disabled</a>.</li>
 
     </head>
 
     <body>
-        <h3>1.8 (versión del código 9)</h3>
-        <p>14 de junio de 2022 - API mínimo 30, API objetivo 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (versión del código 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 de junio de 2022</a> - API mínimo 30, API objetivo 32</p>
         <ul>
             <li>Incluir el <a href="https://redmine.stoutner.com/issues/851">estado de la red de voz</a> para determinar la seguridad general de la red celular.</li>
             <li>Corregir un error que a veces <a href="https://redmine.stoutner.com/issues/850">impedía desactivar las notificaciones</a>.</li>
 
     </head>
 
     <body>
-        <h3>1.8 (version de code 9)</h3>
-        <p>14 June 2022 - API minimum 30, API cible 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (version de code 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 June 2022</a> - API minimum 30, API cible 32</p>
         <ul>
             <li>Include the <a href="https://redmine.stoutner.com/issues/851">voice network status</a> in determining the overall security of the cell network.</li>
             <li>Fix a bug that sometimes <a href="https://redmine.stoutner.com/issues/850">prevented notifications from being disabled</a>.</li>
 
     </head>
 
     <body>
-        <h3>1.8 (versione codice 9)</h3>
-        <p>14 Giugno 2022 - minima API 30, target API 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (versione codice 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 Giugno 2022</a> - minima API 30, target API 32</p>
         <ul>
             <li>Incluso lo <a href="https://redmine.stoutner.com/issues/851">stato della rete voce</a> nella determinazione della sicurezza complessiva della rete.</li>
             <li>Correzione di un baco che talvolta <a href="https://redmine.stoutner.com/issues/850">impediva di disabilitare le notifiche</a>.</li>
 
     </head>
 
     <body>
-        <h3>1.8 (код версии 9)</h3>
-        <p>14 июня 2022 года - минимальный API 30, целевой API 32</p>
+        <h3><a href="https://www.stoutner.com/privacy-cell-1-8/">1.8</a> (код версии 9)</h3>
+        <p><a href="https://gitweb.stoutner.com/?p=PrivacyCell.git;a=commitdiff;h=f60b140868c2f0d564657e96d48508b4fbdc546b">14 июня 2022 года</a> - минимальный API 30, целевой API 32</p>
         <ul>
             <li>Теперь при определении общей безопасности сотовой сети <a href="https://redmine.stoutner.com/issues/851">будет учитываться статус голосовой сети</a>.</li>
             <li>Исправлена ошибка, из-за которой иногда <a href="https://redmine.stoutner.com/issues/850">не удавалось отключить уведомления</a>.</li>
 
             // Instantiate the protocol helper.
             val protocolHelper = ProtocolHelper()
 
+            // Get a handle for the telephony manager.
+            val telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
+
             // Define the phone state listener.  The `PhoneStateListener` can be replaced by `TelephonyCallback` once the minimum API >= 31.
             phoneStateListener = object : PhoneStateListener() {
                 @Deprecated("Deprecated in Java")
                 override fun onServiceStateChanged(serviceState: ServiceState) {  // Update the voice network status.
-                    // Get the network registration info for the voice network, which is the second of the three entries (the first appears to be Wi-Fi and the third appears to be the cell data network).
-                    val networkRegistrationInfo = serviceState.networkRegistrationInfoList[1]
-
-                    // Get the consider 3G antiquated preference.
-                    val consider3gAntiquated = sharedPreferences.getBoolean(getString(R.string.consider_3g_antiquated_key), false)
-
-                    // Update the voice network security status.
-                    voiceNetworkSecurityStatus = protocolHelper.checkNetwork(networkRegistrationInfo.accessNetworkTechnology, consider3gAntiquated)
-
-                    // Populate the notification.
-                    populateNotification()
+                    // Check to see if realtime monitoring is enabled.  Sometimes the system keeps running the service even when it is supposed to shut down.
+                    if (sharedPreferences.getBoolean(applicationContext.getString(R.string.realtime_monitoring_key), true)) {  // Realtime monitoring is enabled.
+                        // Get the network registration info for the voice network, which is the second of the three entries (the first appears to be Wi-Fi and the third appears to be the cell data network).
+                        val networkRegistrationInfo = serviceState.networkRegistrationInfoList[1]
+
+                        // Get the consider 3G antiquated preference.
+                        val consider3gAntiquated = sharedPreferences.getBoolean(getString(R.string.consider_3g_antiquated_key), false)
+
+                        // Update the voice network security status.
+                        voiceNetworkSecurityStatus = protocolHelper.checkNetwork(networkRegistrationInfo.accessNetworkTechnology, consider3gAntiquated)
+
+                        // Populate the notification.
+                        populateNotification()
+                    } else {  // Realtime monitoring is disabled.
+                        // Cancel the current listener if it exists.  The `PhoneStateListener` can be replaced by `TelephonyCallback` once the minimum API >= 31.
+                        telephonyManager.listen(phoneStateListener, LISTEN_NONE)
+                    }
                 }
 
                 @Deprecated("Deprecated in Java")
                 override fun onDisplayInfoChanged(telephonyDisplayInfo: TelephonyDisplayInfo) {  // Update the data network status.
-                    // Get the consider 3G antiquated preference.
-                    val consider3gAntiquated = sharedPreferences.getBoolean(getString(R.string.consider_3g_antiquated_key), false)
-
-                    // Update the data network security status.
-                    dataNetworkSecurityStatus = protocolHelper.checkNetwork(telephonyDisplayInfo.networkType, consider3gAntiquated)
-
-                    // Populate the notification.
-                    populateNotification()
+                    // Check to see if realtime monitoring is enabled.  Sometimes the system keeps running the service even when it is supposed to shut down.
+                    if (sharedPreferences.getBoolean(applicationContext.getString(R.string.realtime_monitoring_key), true)) {  // Realtime monitoring is enabled.
+                        // Get the consider 3G antiquated preference.
+                        val consider3gAntiquated = sharedPreferences.getBoolean(getString(R.string.consider_3g_antiquated_key), false)
+
+                        // Update the data network security status.
+                        dataNetworkSecurityStatus = protocolHelper.checkNetwork(telephonyDisplayInfo.networkType, consider3gAntiquated)
+
+                        // Populate the notification.
+                        populateNotification()
+                    } else {  // Realtime monitoring is disabled.
+                        // Cancel the current listener if it exists.  The `PhoneStateListener` can be replaced by `TelephonyCallback` once the minimum API >= 31.
+                        telephonyManager.listen(phoneStateListener, LISTEN_NONE)
+                    }
                 }
             }
 
 
 
     dependencies {
         classpath 'com.android.tools.build:gradle:7.2.1'
-        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"
+        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
 
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files