Skip to main content

Scripts Page

This page allows users to configure script commands to apply to the device.

Add Scripts page

  • <> Angle brackets indicate required fields
  • [] Square brackets indicate optional fields

BATTERY_OPTIMIZATION

BATTERY_OPTIMIZATION <action> <package>

Enables or disables battery optimization for the given package.

  • action - Required parameter. Allowed values:

    • ENABLE - enable battery optimization for the given package. i.e. the app's background processing capability will be diminished for the sake of improved battery life.
    • DISABLE - the given package will not be limited by the battery optimization feature in any way. Could result in decreased battery life.
  • package - Package name of the app for which battery optimization should be adjusted.

BROADCAST

BROADCAST <arguments>

Broadcasts the intent with the specified intent arguments. Supported extra arguments:

  • -e | -es - Add string data as a key-value pair
  • -ef - Add float data as a key-value pair
  • -ei - Add integer data as a key-value pair
  • -el - Add long data as a key-value pair
  • -ez - Add boolean data as a key-value pair

COPY

COPY <source-file-path> <target-file-path> <overwrite>

Copies a file located on-device from one location to another. If the target-file-path does not exist, it will be automatically created for you, even multiple folders deep if necessary.

  • source-file-path - the full path to the source file to be copied, starting with /.

  • target-file-path - the full path to the destination location where the file should be copied to. Should include the destination file name as well.

  • overwrite - true or false. if set to true, the copy should overwrite an existing file. if set to false, the copy should not overwrite an existing file.

DELETE

DELETE <path> [pattern] [include]

Recursively deletes files/folders starting from path, only if the name matches the pattern regular-expression. If folder path is empty at the end of the process it will be deleted, as well.

  • pattern - Optional regular expression to match. Often, this would just be the name of the file to be deleted. Default value: "^.+$" (i.e. delete all files with names one or more characters long).

  • include - Optional value. If include is true, the matching entries will be deleted. If include is false, the non-matching entries will be deleted. Default value: true.

INFLATE

INFLATE <archive-path> <target-path>

Inflates the ZIP archive found at archive-path to target-path folder.

INSTALL

INSTALL <apk-path>

Installs an application given a complete path to an installable APK.

INSTALL_KEY_MAPPING

INSTALL_KEY_MAPPING <file-path> [persistence-type]

Installs a new keyboard configuration.

  • file-path - required path to keyboard editor zip file.
  • persistence-type - Optional persistence modifier. Defaults to REBOOT_PERSISTENT if not specified. Allowed values:
    • REBOOT_PERSISTENT - keyboard configuration will persist through normal device reboots
    • ENTERPRISE_RESET_PERSISTENT - keyboard configuration will persist through enterprise resets

LAUNCH

LAUNCH <package-name>

Starts the launching intent given an application package-name.

SET_SETTING

SET_SETTING <namespace> <setting> <value>

Set a system setting. namespace must be one of: GLOBAL, SECURE, or SYSTEM.

SHELL

SHELL <adb_shell_command>

Run an arbitrary adb shell command. This is an experimental feature. Not all shell commands that work at an adb shell prompt will work here. No output that may be provided in the command will be displayed.

  • adb_shell_command - the adb shell command to run. This could be any command you can run at an adb shell prompt, although the adb shell has different permission levels than Scan2Deploy, so there is no guarantee if the command will run successfully or not.

  • Android's official documentation for SHELL command can be found here.

UNINSTALL

UNINSTALL <package-name>

Uninstalls a previously installed application given its package-name.

WAIT

WAIT <milliseconds>

Suspend the script execution for milliseconds milliseconds.