An action block that executes a shell command through ADB, on the local or a remote Android device.
The fiber will pause until the command has completed.
The command should be formatted as it would when executed at a shell prompt (without adb shell
prefix),
that includes proper escaping. Use the cliEncode function when including a filename or other text as an argument.
A device has to be configured to accept incoming ADB connections. On Android 11+ devices, enable the Wireless debugging option in system Developer settings. On Android 10 or lower devices, it has to be enabled using a USB connected PC, please read ADB.
Every connection requires authentication in the form of a 2048-bit RSA key-pair.
If the TLS option is enable, the public key should be encoded in a self-signed X.509 certificate which is used along with the private key for TLS encryption.
If disabled, the private key is used to sign a “challenge-response” sent by the device, but the connection is unencrypted.
Click the Install generated key button to create such a key-pair, or create it elsewhere,
e.g. with a tool like openssl
, then install it in system Security settings.
Once an alias of an installed key has been chosen, the system will grant Automate perpetual usage, but the secret key material remains inaccessible, e.g. for export or backup.
A key-pair has to be authorized manually by the user, click the Pair device button to show a dialog to perform the process. When using Wireless debugging the pairing process first has to be started by clicking the Pair device with pairing code button in system Developer settings, Wireless debugging. Paring a device with itself may be awkward due to the system paring dialog closing when navigating away from Settings, try using the “split screen” feature, i.e. click app icon on “recent” screen.
The port for an Wireless debugging connection can change at device reboot, use the Network service discover block with the Android Debug Bridge (ADB) over TLS service type to perform a lookup prior to this block. A device may refuse additional connections while already connected through USB cable, disconnect it.
The standard output and error will contain the full text as generated by the command during its execution.
The exit code is usually set to 0
(zero) for a successful execution of the command.
Privacy warning! If the TLS option is disabled the connection may be unencrypted, don’t connect to a remote device over a public network.