Android的 - 使用意向的URI启动命令行活动 [英] Android - start an activity from command line using intent uri
本文介绍了Android的 - 使用意向的URI启动命令行活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下意图过滤器的活动A
I have an Activity A with the following intent filter
<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>
I am basically trying the custom data scheme in intent filters as explained here
要测试是否IntentUri启动活动或没有我想通过终端使用以下命令火的意图:
To test whether the IntentUri launches the activity or not I'm trying to fire the intent using the following command through terminal :
adb shell am start intent://show/#Intent;scheme=customapp;package=com.comp.pac;end
我收到以下错误:
I get the following error :
Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=intent://show/ flg=0x10000000 }
问:这有什么错的命令?如果没有,什么是测试的意图URI是否启动该活动的最简单的方法?
有关使用亚行
命令使用URI的意图开始活动的说明可的这里。
The instructions for using the adb
command to start activity using intent uri is available here.
推荐答案
您需要使用,
:
adb shell 'am start "intent:#Intent;scheme=customapp;package=com.comp.pac;end"'
这篇关于Android的 - 使用意向的URI启动命令行活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文