【发布时间】:2021-01-23 13:12:03
【问题描述】:
NFC 读取卡时,它会自行打开应用程序,但我只想在打开此应用程序时读取 NFC
<activity
android:name="MyActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
</activity>
nfc_tech_intent_filter
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.IsoDep</tech>
</tech-list>
</resources>
【问题讨论】:
-
您能详细说明您期望的变化吗?
-
我不知道,只分享代码。我的问题是当 NFC 读取卡时,它会打开应用程序。我想在用户登录时读取 NFC。
标签: android android-studio nfc ndef cardreader