user required receiver flags

This commit is contained in:
Adam Velebil 2023-05-24 09:58:48 +02:00
parent b37cc66b5c
commit 7307115c40
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10
2 changed files with 16 additions and 2 deletions

View File

@ -99,6 +99,7 @@ dependencies {
// Lifecycle
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation "androidx.core:core-ktx:1.10.1"
implementation 'androidx.fragment:fragment-ktx:1.5.7'
implementation 'androidx.preference:preference-ktx:1.2.0'

View File

@ -35,6 +35,7 @@ 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.view.WindowCompat
import androidx.lifecycle.lifecycleScope
import com.yubico.authenticator.logging.FlutterLog
@ -166,10 +167,22 @@ class MainActivity : FlutterFragmentActivity() {
})
}
@SuppressLint("WrongConstant")
override fun onStart() {
super.onStart()
registerReceiver(qrScannerCameraClosedBR, QRScannerCameraClosedBR.intentFilter)
registerReceiver(nfcAdapterStateChangeBR, NfcAdapterStateChangedBR.intentFilter)
val receiverFlags = ContextCompat.RECEIVER_NOT_EXPORTED
ContextCompat.registerReceiver(
this,
qrScannerCameraClosedBR,
QRScannerCameraClosedBR.intentFilter,
receiverFlags
)
ContextCompat.registerReceiver(
this,
nfcAdapterStateChangeBR,
NfcAdapterStateChangedBR.intentFilter,
receiverFlags
)
}
override fun onStop() {