发送意向到App在模拟器 [英] Send Intent to App in Emulator

查看:206
本文介绍了发送意向到App在模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是它在某种程度上可以自动发送意图到一个应用程序的仿真器内部进行测试?

Is it somehow possible to send automated intents to an app inside an emulator for testing?

我有我的所有意图的名单,我想automaticily测试它们,所以有可能只是做一个 ADB< myfancycommand> android.intent.action.PACKAGE_ADDED 来调用 ndroid.intent.action.PACKAGE_ADDED 在设备上?还是我必须给我写,通过自己的呼吁所有的东西,因此,例如这个意图在设备上安装一个虚拟的apk脚本? (或者手机短信发送,或者BOOT_COMPLETED重新启动设备等)

I have a list of all my intents and i want to test them automaticily, so is it possible to just do a adb <myfancycommand> android.intent.action.PACKAGE_ADDED to call a ndroid.intent.action.PACKAGE_ADDED on the device? Or do i have to write me a script that calls all the stuff by its own, so for example for this intent install a dummy apk on the device? (Or for sms send one, or BOOT_COMPLETED restart the device, etc)

与测试方法不起作用这样做,是因为我在这里做的APK软件包的一些动态的分析,因此我只有apk文件而不是源

doing this with a test method will not work, because i doing some dynamic analyses of the APK Packages here, and therefore i only have the apk file and not the source

推荐答案

更​​简单的是使用应用程序。

Even more simple is the use of the am application.

您只需从亚行shell中运行它是这样的:

You can just run it like this from the adb shell:

# am broadcast android.net.conn.CONNECTIVITY_CHANGE
Broadcasting: Intent { act=android.intent.action.VIEW dat=android.net.conn.CONNECTIVITY_CHANGE }
Broadcast completed: result=0
# am broadcast android.intent.action.BOOT_COMPLETED
Broadcasting: Intent { act=android.intent.action.VIEW dat=android.intent.action.BOOT_COMPLETED }
Broadcast completed: result=0

这篇关于发送意向到App在模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆