From: Soren Stoutner Date: Tue, 17 Aug 2021 05:54:19 +0000 (-0700) Subject: Reregister the listener on every resume. X-Git-Tag: v1.0~6 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=d4477ae05aa9f47dfab32a7e0a6a55cd412eedf4;p=PrivacyCell.git Reregister the listener on every resume. --- diff --git a/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt b/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt index c8c7712..b30d0fd 100644 --- a/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt +++ b/app/src/main/java/com/stoutner/privacycell/activities/PrivacyCell.kt @@ -73,8 +73,13 @@ class PrivacyCell : AppCompatActivity(), PhonePermissionDialog.StoragePermission // Get handles for the context and the telephony manager. context = this telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager + } + + override fun onResume() { + // Run the default commands. + super.onResume() - // Check to see if the read phone state permission has been granted. + // Check to see if the read phone state permission has been granted. These commands need to be run on every resume so that the listener gets reassigned as it is automatically paused. if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) { // The storage permission has been granted. // Populate Privacy Cell. populatePrivacyCell()