Some NFC fixes for Android 12 (#1830)

This commit is contained in:
Daniel Shokouhi 2021-10-24 15:48:09 -07:00 committed by GitHub
parent e1cc6c8dcb
commit ff20e4502b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -284,7 +284,7 @@
<activity
android:name=".nfc.TagReaderActivity"
android:label="@string/tag_reader_title"
android:exported="false">
android:exported="true">
<tools:validation testUrl="https://www.home-assistant.io/tag/123e4567-e89b-12d3-a456-426614174000" />
<intent-filter>

View file

@ -37,7 +37,7 @@ object NFCUtil {
fun <T> enableNFCInForeground(nfcAdapter: NfcAdapter, activity: Activity, classType: Class<T>) {
val pendingIntent = PendingIntent.getActivity(
activity, 0,
Intent(activity, classType).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), PendingIntent.FLAG_IMMUTABLE
Intent(activity, classType).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), PendingIntent.FLAG_MUTABLE
)
val nfcIntentFilter = IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED)
val filters = arrayOf(nfcIntentFilter)