Send Intent to App in Emulator

你。 提交于 2019-12-09 10:26:48

问题


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

I have a list of all my intents and I want to test them automaticily, so is it possible to just do a adb shell <myfancycommand> android.intent.action.PACKAGE_ADDED to initiate the android.intent.action.PACKAGE_ADDED action on the device? Or do I have to write a script that calls all the stuff by its own, so for example for this intent install a dummy apk on the device?


回答1:


Even more simple is the use of the am application.

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



回答2:


Found this APK: http://isecpartners.com/mobile-security-tools/intent-fuzzer.html it does send null values to the apps to see if they are failing. Because the Source is available you can easily change it to some random value and see if you get some respond!



来源:https://stackoverflow.com/questions/10277796/send-intent-to-app-in-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!