Silk Mobile

Table of Contents (Homepage)

Run

String Run(String command)

images/images/os-icons/os_android_150x150.png

Description

Run adb commands or other device shell commands.

Parameters

  • Command : The command to run

Usage

The 'Run' command provides you the ability to run many commands for advanced capabilities.

The following example will demonstrate how to get the version of the device.

We will use the command getprop ro.build.version.release.

Step 1: Devices one is connected through cloud (Nexus 4) and other is connected locally via USB (Nexus 5).

images/download/attachments/3309811/10.jpg

Step 2: Getting the version number from cloud device (Nexus 4).

images/download/attachments/3309811/11.jpg

Step 3: Getting the version from the physically connected devices via USB (Nexus 5).

images/download/attachments/3309811/12.jpg

Code Examples

To open Settings screen of the device:
client.run("adb shell am start -a android.settings._SETTINGS")
To open Wifi screen on the device:
client.run("adb shell am start -a android.settings.WIFI_SETTINGS")
For pressing Volume key up:
client.run("adb shell input keyevent "KEYCODE_VOLUME_UP"')
For pressing Volume key down:
client.run("adb shell input keyevent "KEYCODE_VOLUME_DOWN"')
Call a number:
client.run("adb shell am start -a android.intent.action.CALL -d tel:+6512345678");