In part of my testing I’m checking if my app can handle returning from airplane mode to normal mode.
Looking for a process that enable/disable airplane mode on real Android device.
All I found is how to enable/disable WiFi and data on simulator here - Best way to turn airplane mode on and off with Calabash. Tried to run those commands on my real device (LG G3 – Android 5.0) and nothing happened.
Looking on my services list on my device (adb shell service list) but cannot find airplane.
I understand that changing to airplane mode is disabling the data/WiFi/Bluetooth/GPS
Is there a way to enable airplane mode on real device? Or even just the data/WiFi (enough for my testing)?
If you have no luck with adb commands, You can enable/disable airplane mode with
adb shell inputgestures.Where
x1,x2,y1,x2is swipe start and end coordinates andtimeis time in ms to perform the gesture.By combining these, you can perform anything on screen.
For example airplane mode.
Not the best way to do that, but comes handy sometimes.
Another way around that
https://developer.android.com/reference/android/provider/Settings.Global.html
Check the settings you interested in, and use
adb shell settings putFor example:
A question about events:
How to use ADB to send touch events to device using sendevent command?