【发布时间】:2012-06-29 06:52:10
【问题描述】:
我正在创建一个使用 nfc 签入的 Andriod 应用程序 假设标签中的网址是“http://examples.com” 我希望只有当我点击该标签时才能打开应用程序。
所以基本上我只会在我的 mainfest 中编辑意图过滤器。这样每次我点击带有http://developer.andriod.com/index.html url 的标签时,应用程序就会打开
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="http"
android:host="developer.android.com"
android:pathPrefix="/index.html" />
</intent-filter>
【问题讨论】:
-
请先阅读文档:developer.android.com/guide/topics/connectivity/nfc/…。您的案例在示例中得到了完整的解释。
-
@NFCguy 请检查我编辑的问题?
-
你需要使用“android.intent.category.DEFAULT”;动作和类别都需要完全匹配。
-
好的,谢谢你的帮助:)