我正在尝试启用深层链接,以便某些链接启动我的应用程序。
我读了这个教程https://developer.android.com/training/app-indexing/deep-linking.html并非常接近它,但是当我尝试使用adb将VIEW意图发送到该应用程序进行测试时,我只是得到错误
Error: Activity not started, unable to resolve Intent { act=android.intent.actio n.VIEW dat=example://gizmos flg=0x10000000 pkg=com.myapp.DeepLinkActivity }
DeepLinkActivity.java
public class DeepLinkActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getIntent().getAction() == Intent.ACTION_VIEW) { Uri uri = getIntent().getData(); } } }
Android Manifest宣布Deeplink活动
ADB命令发送视图意图
adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos" com.myapp.DeepLinkActivity
但我认为我甚至不需要完整的活动路径
adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos" com.myapp
Kamil Sarna.. 7
尝试完全跳过软件包参数。我有完全相同的问题,它可以工作。
adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos"