From d4477ae05aa9f47dfab32a7e0a6a55cd412eedf4 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Mon, 16 Aug 2021 22:54:19 -0700 Subject: [PATCH] Reregister the listener on every resume. --- .../com/stoutner/privacycell/activities/PrivacyCell.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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() -- 2.43.0