From 9e7251c6955792eaef392af9384ee9995f877c41 Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Tue, 11 Apr 2023 16:28:58 +0200 Subject: [PATCH] use ContextCompat for BRs --- android/app/build.gradle | 1 + android/app/src/main/AndroidManifest.xml | 8 ++++++++ .../com/yubico/authenticator/MainActivity.kt | 16 ++++++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 0bdc0a94..56ba65f9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -99,6 +99,7 @@ dependencies { // Lifecycle implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1' + implementation 'androidx.core:core-ktx:1.10.0' implementation 'androidx.fragment:fragment-ktx:1.5.6' implementation 'androidx.preference:preference-ktx:1.2.0' diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index bc27f12a..69de2efb 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -4,6 +4,14 @@ + + + + diff --git a/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt b/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt index dc76bcd1..9a4fb5ed 100644 --- a/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt +++ b/android/app/src/main/kotlin/com/yubico/authenticator/MainActivity.kt @@ -35,6 +35,8 @@ import android.os.Bundle import android.provider.Settings.ACTION_NFC_SETTINGS import android.view.WindowManager import androidx.activity.viewModels +import androidx.core.content.ContextCompat +import androidx.core.content.ContextCompat.RECEIVER_NOT_EXPORTED import androidx.core.view.WindowCompat import androidx.lifecycle.lifecycleScope import com.yubico.authenticator.logging.FlutterLog @@ -168,8 +170,18 @@ class MainActivity : FlutterFragmentActivity() { override fun onStart() { super.onStart() - registerReceiver(qrScannerCameraClosedBR, QRScannerCameraClosedBR.intentFilter) - registerReceiver(nfcAdapterStateChangeBR, NfcAdapterStateChangedBR.intentFilter) + ContextCompat.registerReceiver( + this, + qrScannerCameraClosedBR, + QRScannerCameraClosedBR.intentFilter, + RECEIVER_NOT_EXPORTED + ) + ContextCompat.registerReceiver( + this, + nfcAdapterStateChangeBR, + NfcAdapterStateChangedBR.intentFilter, + RECEIVER_NOT_EXPORTED + ) } override fun onStop() {