Block reference / Device Management
ADB command
Run a command in the phone's shell, as adb shell does, and keep what it prints.
Only in
WarpX Phone
ADB command runs one line in the phone's shell and hands on what it prints. It reaches what no other block does: Android's settings, the package manager, system properties, dumpsys. The command runs as the shell user, as adb shell does from a computer, not as root.
{{variables.userApps}}.Settings
- Command
The unlabelled box at the top: the command, up to 4,000 characters. Several commands can go on one line separated by
;, and references such as{{variables.package}}are filled in first.Examplepm list packages -3- Timeout (ms)
How long the command may run, from
100to300000milliseconds. The default is30000.Example30000- Assign to variable
Stores what the command printed in a workflow variable.
ExampleChecked- Variable namewhen Assign to variable is on
The variable to write. Later blocks read it as
{{variables.userApps}}; start the name with$push:to add to a list instead of replacing it.ExampleuserApps- Insert to table
Writes what the command printed into a column of the workflow's table. Only offered once the table has columns (Table in the toolbar).
ExampleUnchecked- Select columnwhen Insert to table is on
The table column to write to.
Exampleapps- Delay (ms)
A wait after the block finishes, before the next one starts. One number such as
1000, or a range such as1000,3000for a random wait in that range on each run.Example0
Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.
What it hands on
What the command printed, with trailing spaces and line breaks trimmed, goes to the variable and the chosen column when ticked, and is handed on as {{prevBlockData}}.
Example: List the apps installed on a phone
- Start
- ADB command
- Pick the phone in the toolbar's phone menu.
- Add an ADB command block and type
pm list packages -3in the box. - Tick Assign to variable and set Variable name to
userApps. - Click Run.
- Open Logs:
userAppsholds onepackage:line per app the person installed.
Good to know
- The block does not look at the command's exit status. A command that fails still succeeds, and its error message is what it printed.
- A command that does not end on its own, such as
logcat, runs until the timeout and the block fails withSHELL_TIMEOUT. - On a rooted phone,
su -c '…'runs a command as root; Magisk asks on the phone, once, before it lets the shell. - An empty command fails with
The shell command is empty. - Before a run of a workflow somebody else made — from the Appstore, a file or the assistant — WarpX Phone shows what this block will do and asks first. Workflows you set up in your own editor never ask. The approval is listed under Phone shell, since this block can run anything the phone's shell can.
See also
- Get device property — Read one fact about the phone, such as its model, Android version, battery level or IP.
- Toggle service — Switch Wi-Fi, mobile data, Bluetooth, airplane mode or location on or off.
- Change device — Change what the phone says it is: its name, its model and brand, its screen size and density.
- Transfer file — Copy a file from this computer to the phone, or from the phone to this computer.