500*_*865 3 android url-scheme adb intentfilter android-intent
我有一个带有以下intent过滤器的Activity A.
<activity
android:name="com.comp.pac.ActivityA">
<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="customapp"
android:host="show"
android:path="/"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
我基本上是试图自定义数据方案的意图过滤器作为解释这里
要测试IntentUri是否启动活动,我试图通过终端使用以下命令触发意图:
adb shell am start intent://show/#Intent;scheme=customapp;package=com.comp.pac;end
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=intent://show/ flg=0x10000000 }
问题:命令有什么问题吗?如果没有,测试意图uri是否开始活动的最简单方法是什么?
有关使用adb命令以使用intent uri启动活动的说明,请参见此处.
你需要使用"":
adb shell 'am start "intent:#Intent;scheme=customapp;package=com.comp.pac;end"'
Run Code Online (Sandbox Code Playgroud)
在此处输入代码打开活动的另一种方式:
$ adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos" com.example.android
Run Code Online (Sandbox Code Playgroud)