DIY-Actions: Execute Command, Execute Root Command
Posted: 11 Apr 2013 09:49
Hi,
Many interesting features available on Android can be accessed on the command line respectively by using the actions Execute Command and Execute Root Command.
The goal of this post is to collect interesting commands that extend the capabilities of Automagic (it is not the goal to create a complete Android command line reference).
Feel free to add more commands and variations of already listed commands by replying to this post. Optionally also include a link to a published flow that shows how the feature can be used.
Thanks!
Martin
Not all commands work on all devices/Android versions.
Action Execute Command
Command: ps
Report a snapshot of the current processes running on the device. Use variable stdout to access the output.
Command: am bug-report
Developer options and USB debugging must be enabled. Create a bug report using all kind of system data including a screenshot and allows the data to be sent by mail after a few seconds. Device vibrates when the bug report is created and ready to be sent. This method might be useful to create a screenshot without root. The screenshot is stored in /mnt/sdcard/Pictures/Screenshot/Screnshot_<timestamp>.png
Action Execute Root Command use at your own risk and have a backup ready
Command: screencap -p /mnt/sdcard/test.png
Create a screenshot and store in the specified file.
Command: input text <text>
Enters the specified text into the currently focused text field or component.
Command: input keyevent <keyevent>
Newer Android devices (Android 4+) can use the name of the key event, older Android devices have to use the numeric value of the key event.
Simulates the specified keyevent. Keyevent values are available here: API doc KeyEvent and here: Simulating keypress events on Android
Simulate DPAD:
input keyevent DPAD_UP resp. input keyevent 19
input keyevent DPAD_DOWN resp. input keyevent 20
input keyevent DPAD_LEFT resp. input keyevent 21
input keyevent DPAD_RIGHT resp. input keyevent 22
input keyevent DPAD_CENTER resp. input keyevent 23
Press the Power button to turn off the display: input keyevent POWER resp. input keyevent 26
Press the menu key to pass the slide to unlock keyguard: input keyevent MENU resp. input keyevent 82
Enter a pin/pass in the keyguard and press enter: input text 1234, input keyevent ENTER resp. input keyevent 66
Command: reboot
Reboot the device. Be careful, seems a little bit too fast for a regular shutdown.
Command: reboot -p
Shutdown the device. Be careful, seems a little bit too fast for a regular shutdown.
Command: pm disable <package name>
Disable an app/package and also stops services and processes of the specified package.
Command: pm enable <package name>
Enable a disabled app/package again.
Command: am force-stop <package name>
Force-stop an app/package. Might be an alternative way to kill an app.
Command: service call activity 42 s16 com.android.systemui
Remove/Stop the statusbar/buttonbar (back, home, recents) to gain screen real estate.
Command: am startservice -n com.android.systemui/.SystemUIService
Show/Restart the statusbar/buttonbar (back, home, recents). You might need to reset your wallpaper.
Many interesting features available on Android can be accessed on the command line respectively by using the actions Execute Command and Execute Root Command.
The goal of this post is to collect interesting commands that extend the capabilities of Automagic (it is not the goal to create a complete Android command line reference).
Feel free to add more commands and variations of already listed commands by replying to this post. Optionally also include a link to a published flow that shows how the feature can be used.
Thanks!
Martin
Not all commands work on all devices/Android versions.
Action Execute Command
Command: ps
Report a snapshot of the current processes running on the device. Use variable stdout to access the output.
Command: am bug-report
Developer options and USB debugging must be enabled. Create a bug report using all kind of system data including a screenshot and allows the data to be sent by mail after a few seconds. Device vibrates when the bug report is created and ready to be sent. This method might be useful to create a screenshot without root. The screenshot is stored in /mnt/sdcard/Pictures/Screenshot/Screnshot_<timestamp>.png
Action Execute Root Command use at your own risk and have a backup ready
Command: screencap -p /mnt/sdcard/test.png
Create a screenshot and store in the specified file.
Command: input text <text>
Enters the specified text into the currently focused text field or component.
Command: input keyevent <keyevent>
Newer Android devices (Android 4+) can use the name of the key event, older Android devices have to use the numeric value of the key event.
Simulates the specified keyevent. Keyevent values are available here: API doc KeyEvent and here: Simulating keypress events on Android
Simulate DPAD:
input keyevent DPAD_UP resp. input keyevent 19
input keyevent DPAD_DOWN resp. input keyevent 20
input keyevent DPAD_LEFT resp. input keyevent 21
input keyevent DPAD_RIGHT resp. input keyevent 22
input keyevent DPAD_CENTER resp. input keyevent 23
Press the Power button to turn off the display: input keyevent POWER resp. input keyevent 26
Press the menu key to pass the slide to unlock keyguard: input keyevent MENU resp. input keyevent 82
Enter a pin/pass in the keyguard and press enter: input text 1234, input keyevent ENTER resp. input keyevent 66
Command: reboot
Reboot the device. Be careful, seems a little bit too fast for a regular shutdown.
Command: reboot -p
Shutdown the device. Be careful, seems a little bit too fast for a regular shutdown.
Command: pm disable <package name>
Disable an app/package and also stops services and processes of the specified package.
Command: pm enable <package name>
Enable a disabled app/package again.
Command: am force-stop <package name>
Force-stop an app/package. Might be an alternative way to kill an app.
Command: service call activity 42 s16 com.android.systemui
Remove/Stop the statusbar/buttonbar (back, home, recents) to gain screen real estate.
Command: am startservice -n com.android.systemui/.SystemUIService
Show/Restart the statusbar/buttonbar (back, home, recents). You might need to reset your wallpaper.