0

I am using calabash-android to test my application. I would like to write tests that alter android settings and test my app against these various settings.

How can I make calls into android to say "Turn on airplane mode" and test my app, or "turn off wifi and test my app" or "There are lots of cases.... where can I find this ability" ....

Thanks

superstar3000
  • 389
  • 5
  • 16

1 Answers1

0

To change these settings you'll need usb debugging enabled (which I assume you have already) and a rooted device, as these settings are in a root access only database. Using the example of airplane mode here's how you would do it. To turn on airplane mode:

adb shell settings put global airplane_mode_on 1
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true

To turn it off again:

adb shell settings put global airplane_mode_on 0
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
alannichols
  • 1,496
  • 1
  • 10
  • 20