2
我正在开发一款需要与NFC标签进行深层链接的Android应用。通过NFC标签深入链接到应用(特定活动)
在这里你可以看到我的意图过滤器的活动:
<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>
现在,当我在亚行的应用程序启动这个命令用正确的活动(ScheduleActivity)开始:
adb shell am start -W -a android.intent.action.VIEW -d "http://www.testdeeplink.com/schedule?stop_id=1" com.exmemple.android
但是,当我使用NFC标签对网址进行编码,扫描该标签即可启动手机的网络浏览器。使用NFC标签开始活动时错过了什么?
URL标签上的编码:“http://www.testdeeplink.com/schedule?stop_id=1”
谢谢,您的解决方案的工作,但要确保浏览器没有劫持的意图,我已经使用了一个特定的网址,如:“testdeeplink:// schedule?stop_id = 1” 现在它的工作 –
@ Sagonnicolas是的,使用你自己的方案肯定会阻止浏览器处理链接。另一种方法是在标签上的URL记录*之后为您的应用添加Android应用记录(AAR)。如果应用程序未安装在设备上,这也会使设备在应用程序中打开应用程序。 –