Android– 使用intent uri从命令行启动活动

Android– 使用intent uri从命令行启动活动,第1张

概述我有一个带有以下intent过滤器的ActivityA.<activityandroid:name="com.comp.pac.ActivityA"><intent-filter><actionandroid:name="android.intent.action.VIEW"/><categoryandroid:name

我有一个带有以下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>

我基本上在目标过滤器中尝试自定义数据方案,如here所述

要测试IntentUri是否启动活动,我试图通过终端使用以下命令触发意图:

adb shell am start intent://show/#Intent;scheme=customapp;package=com.comp.pac;end

我收到以下错误:

Activity not started, unable to resolve Intent { act=androID.intent.action.VIEW dat=intent://show/ flg=0x10000000 }

问题:命令有什么问题吗?如果没有,测试意图uri是否开始活动的最简单方法是什么?

有关使用adb命令使用intent uri启动活动的说明,请参见here.

解决方法:

你需要使用“”:

adb shell 'am start "intent:#Intent;scheme=customapp;package=com.comp.pac;end"'
总结

以上是内存溢出为你收集整理的Android – 使用intent uri从命令行启动活动全部内容,希望文章能够帮你解决Android – 使用intent uri从命令行启动活动所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1116438.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存