【发布时间】:2018-03-23 09:35:18
【问题描述】:
我有一个带有两条记录的 NDEF NFC 标签:
- 第一个包含我的网站 URL。
- 第二个是 AAR,其中包含我的旧应用程序的应用程序 ID。
到目前为止,当发现NFC标签时,旧应用程序已正常启动。
但我想创建一个新的应用程序来处理这些 NFC 标签,而不是旧的。
我已在清单中添加:
<android:name=".splash.SplashActivity"
android:screenOrientation="portrait"
android:stateNotNeeded="true"
android:theme="@style/SplashTheme">
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="http://website.com" android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/OLDAPPLICATIONID" />
</intent-filter>
</activity>
我的手机上安装了新应用程序,但是当我点击 NFC 标签时,它会打开 Play 商店并将我重定向到旧应用程序。
是否可以创建在发现包含其他应用程序 ID 的标签时触发的 NFC 过滤器?
【问题讨论】:
标签: android nfc intentfilter ndef android-applicationrecord