当我在adb中输入命令时:
./adb shell am start -W -a android.intent.action.VIEW -d "example:gizmos" com.myapp
我得到了这个错误:
Starting: Intent { act=android.intent.action.VIEW dat=example://gizmos pkg=com.myapp }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=example://gizmos flg=0x10000000 pkg=com.myapp }
但当我在adb中键入命令时:
./adb shell am start -W -a android.intent.action.VIEW -d "example:gizmos" com.myapp.activity.DeepLinkActivity
一切正常,我收到消息,我可以在电话上看到活动启动:
Starting: Intent { act=android.intent.action.VIEW dat=example://gizmos cmp=com.myapp.activity.DeepLinkActivity }
Status: timeout
Activity: com.myapp.activity.DrawerActivity
Complete
我的问题是,为什么我需要获取活动的完整路径,而不仅仅是包名称?因为当外部应用程序或浏览器尝试深度链接时,它们不会调用我的应用程序中的活动。
这是我的AndroidManifest.xml
<activity
android:name=".activity.DeepLinkActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="example"
android:host="gizmos" />
</intent-filter>
</activity>
发布于 2015-04-13 16:41:25
你不需要指定你的活动的完整路径,但如果你想测试你是否对中的URI 做出了正确的反应,你的应用程序只需指定应用程序包:
adb shell am start -a android.intent.action.VIEW -d "example://gizmos" com.myapp
此外,您提供的命令中也有错误-应该是example://gizmos
而不是example:gizmos
发布于 2019-11-07 13:24:47
以下是命令
adb shell am start -d your-deep-link
示例
adb shell am start -d rm://yoursettingpage/v1
发布于 2017-03-24 17:50:40
这里解释了android studio的最佳解决方案:https://code.tutsplus.com/tutorials/how-to-enable-deep-links-on-android--cms-26317
TLDR : Android Studio -->运行-->编辑配置
将启动选项中的启动更改为" URL“,并在文本字段url中输入正确的url:"something://”
https://stackoverflow.com/questions/28802115
复制相似问题