Block reference / Device Management

ADB command

Run a command in the phone's shell, as adb shell does, and keep what it prints.

Only inWarpX 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.

ADB command runs the line in the phone's shell and keeps what it prints in {{variables.userApps}}.
The ADB command block's settings, filled in as in the example below.

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 100 to 300000 milliseconds. The default is 30000.

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 as 1000,3000 for 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

  1. Start
  2. ADB command
Where ADB command sits in the example workflow.
  1. Pick the phone in the toolbar's phone menu.
  2. Add an ADB command block and type pm list packages -3 in the box.
  3. Tick Assign to variable and set Variable name to userApps.
  4. Click Run.
  5. Open Logs: userApps holds one package: 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 with SHELL_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.