Search code examples
androidadb

Closing a window?


I'm opening the connectivity settings on Android with the following command

adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS

Is there any way to close the window? That is, not just put it in the background, but properly close it (i.e. the equivalent of pressing the "X" button)

I have tried force-stop, kill and even kill-all but without success. I could find tons of pages explaining me how to open the window but none explaining how to close it


Solution

  • try sending KEYCODE_BACK, just alike one would manually do that:

    adb shell input keyevent 4