【发布时间】:2016-12-28 10:55:40
【问题描述】:
我正在开发一个需要带有 NFC 标签的深层链接的 Android 应用。
在这里你可以看到我的活动意图过滤器:
<activity
android:name=".ui.schedule.ScheduleActivity"
android:parentActivityName=".ui.home.HomeActivity">
<intent-filter android:label="testDeepLink">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:scheme="http"
android:host="www.testdeeplink.com"
android:pathPrefix="/schedule"/>
</intent-filter>
</activity>
现在,当我在 adb 中启动此命令时,应用程序会以正确的活动 (ScheduleActivity) 启动:
adb shell am start -W -a android.intent.action.VIEW -d "http://www.testdeeplink.com/schedule?stop_id=1" com.exmemple.android
但是,当我在 NFC 标签上对 URL 进行编码时,扫描该标签只会启动我手机的网络浏览器。使用 NFC 标签开始活动时我缺少什么?
标签上编码的 URL:“http://www.testdeeplink.com/schedule?stop_id=1”
【问题讨论】:
标签: android nfc intentfilter deep-linking ndef