Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I pass an Extra to an Android intent using MonkeyRunner?

I am trying to test my app using the MonkeyRunner tool. I am trying to add an EXTRA to my activity. The python script executes without error:

device = MonkeyRunner.waitForConnection()
device.wake()
extra = {'MY_EXTRA', True}
device.startActivity(component="org.mycompany.myapp/.activity.Show",extras=extra)

But when I inspect the intent in my app I do not get the value passed:

boolean myExtra = i.getBooleanExtra("MY_EXTRA", false);

What am I missing? Am I passing in the intent wrong? Am I inspecting the value in the Android app wrong?

like image 812
brendan Avatar asked Feb 03 '11 20:02

brendan


1 Answers

This is a bug in MonkeyRunner. It is not correctly handling passing boolean into extras. If you pass a string instead, it should work.

This fixes this issue.

like image 99
Bill Avatar answered Nov 02 '22 00:11

Bill