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?
Intent shareIntent = Intent. createChooser(sendIntent, null); startActivity(shareIntent); Optionally, you can add extras to include more information, such as email recipients ( EXTRA_EMAIL , EXTRA_CC , EXTRA_BCC ), the email subject ( EXTRA_SUBJECT ), and so on.
createChooser(intent, title); // Try to invoke the intent. // Define what your app should do if no activity can handle the intent. This displays a dialog with a list of apps that respond to the intent passed to the createChooser() method and uses the supplied text as the dialog title.
Starting activities or services. To start an activity, use the method startActivity(intent) . This method is defined on the Context object which Activity extends. The following code demonstrates how you can start another activity via an intent.
Intent Object - Action to make Phone CallIntent phoneIntent = new Intent(Intent. ACTION_CALL);
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With