# Genymotion Shell
Genymotion provides a shell to script the modification of sensor statuses.
This section explains how to use Genymotion Shell and lists the available commands:
- Starting Genymotion Shell
- Interacting with Genymotion Shell
- Interacting with virtual devices
- Interacting with Genymotion
- Using Genymotion Shell from a command prompt or script
# Starting Genymotion Shell
To start Genymotion Shell, perform the action corresponding to your operating system:
Operating System | Instructions |
---|---|
Windows | Click C:\Program Files\Genymobile\Genymotion\genyshell.exe |
macOs | Click /Applications/Genymotion Shell.app/Contents/MacOS/genyshell |
Linux | Run $HOME/genymotion/genymotion-shell or opt/genymotion/genymotion-shell in a terminal. |
# Interacting with Genymotion Shell
With the commands below, you can perform various basic actions related to the use of Genymotion Shell:
Command | Result |
---|---|
help | Displays the list of available commands. |
pause | Pauses the execution of Genymotion Shell. The value must be set in seconds. |
version | Returns Genymotion Shell version. |
exit or quit | Closes Genymotion Shell. |
# Interacting with virtual devices
To modify sensor statuses and values of a virtual device, Genymotion Shell provides commands grouped by category corresponding to the component of the virtual device they interact with. This section lists available commands of each category.
# Devices
Devices commands interact or return results about virtual devices themselves. Available commands are:
Command | Result |
---|---|
devices list | Lists available virtual devices and provides details such as current status, IP address and name. |
devices refresh | Refreshes the virtual device list. |
devices select | Selects a virtual device. Add the ID of the virtual device you wish to select (as displayed in the device list). |
devices ping | Sends a ping message to check that the virtual device is responding. |
devices factoryreset | Resets the virtual device to factory state. Add the ID of the device you wish to reset (as displayed in the device list). Adding the keyword force at the end skips the warning message about data loss. |
# Battery
Battery commands interact with the Battery widget. Available commands are:
Command | Result |
---|---|
battery getmode | Returns the current battery mode of the selected virtual device. |
battery setmode | Sets the battery mode of the selected virtual device. The mode can be:
|
battery getlevel | Returns the current battery charge level of the selected virtual device. If the battery mode is "host", the returned value is the host value. |
battery setlevel | Sets the battery charge level of the selected virtual device. The value must range from 0% to 100%. This command forces the activation of the manual mode. |
battery getstatus | Returns the current battery state of charge of the selected virtual device. |
battery setstatus | Sets the battery state of charge of the selected virtual device. Values can be:
|
# GPS
GPS commands interact with the GPS widget. Available commands are:
Command | Result |
---|---|
gps getstatus | Returns the activation status of the GPS signal reception. |
gps setstatus | Sets the activation status of the GPS signal reception. Values can be:
|
gps getlatitude | Returns the current latitude value (if the GPS is activated and a latitude value is set) or 0. |
gps setlatitude | Sets the latitude value (and forces the activation of the GPS if deactivated). The value must range from -90° to 90°. |
gps getlongitude | Returns the current longitude value (if the GPS is activated and a longitude value is set) or 0. |
gps setlongitude | Sets the longitude value (and forces the activation of the GPS if deactivated). The value must range from -180° to 180°. |
gps getaltitude | Returns the current altitude value (if the GPS is activated and an altitude value is set) or 0. |
gps setaltitude | Sets the altitude value (and forces the activation of the GPS if deactivated). The value must range from -20m to 10000m. |
gps getaccuracy | Returns the current accuracy value (if the GPS is activated and an accuracy value is set) or 0. |
gps setaccuracy | Set the accuracy value (and forces the activation of the GPS if deactivated). The value must range from 0m to 200m. |
gps getbearing | Returns the current bearing value (if the GPS is activated and a bearing value is set) or 0. |
gps setbearing | Sets the bearing value (and forces the activation of the GPS if deactivated). The value must range from 0° to 359.99°. |
# Rotation
The Rotation command interacts with the rotation feature. The command is:
Command | Result |
---|---|
rotation setangle | Sets the rotation angle value of the virtual device. The value must range from 0° to 359°. |
# Android
Android commands interact with the Identifiers widget. Available commands are:
Command | Result |
---|---|
android version | Returns the Android version of the selected virtual device. |
android getandroidid | Returns the Android ID number of the selected virtual device. |
android setandroidid | Sets the Android ID number of the selected virtual device. Values can be:
|
android getdeviceid | Returns the device ID (IMEI/MEID) number of the selected virtual device. |
android setdeviceid | Sets the device ID (IMEI/MEID) number of the selected virtual device. Values can be:
|
# Disk I/O
Disk I/O commands interact with the Disk I/O widget. Available commands are:
Command | Result |
---|---|
clearcache | Clears the disk cache. |
getreadratelimit | Returns the read rate limit in KB/sec. If no read rate limit is set, the read rate is unlimited. |
setreadratelimit | Sets the disk read rate limit in KB/sec. The value must range from 1 to 2097151. Use 0 to disable read rate limit. |
# Network
Network commands interact with the Network widget. Available commands are:
Command | Result |
---|---|
network getprofile | Returns the current network profile of the selected virtual device. |
network setprofile | Sets the network profile of the selected virtual device. Values can be:
|
# Phone
Phone commands interact with the Phone widget. Available commands are:
Command | Result |
---|---|
phone call {phone_number} | Simulates an incoming phone call from a given phone number. |
phone sms {phone_number} {message} | Simulates an incoming text message from a given phone number. |
phone baseband {command} | Sends commands directly to the baseband. This has been implemented in order to ease script creation. For more information on the phone baseband command and its capabilities, please refer to the drop-down list below. |
Baseband
The phone baseband
commands send raw data directly to the baseband. In this section, you will find all commands available in Genymotion Shell to directly interact with the baseband.
Commands below return results in your logcat.
Command | Result |
---|---|
gsm list | Lists all incoming and outgoing phone calls and their state. |
gsm call {phone_number} | Simulates a new incoming call from a given phone number. |
gsm busy {remote_number} | Hangs up an outgoing call (performed from the integrated Dialer application) and reports the remote phone as busy. |
gsm hold {remote_number} | Simulates that an incoming or outgoing phone call (performed from the integrated Dialer application) is put on hold. |
gsm accept {remote_number} | Simulates that the outgoing phone call (performed from the integrated Dialer application) is answered. |
gsm cancel {phone_number} | Simulates that an incoming or outgoing phone call is hung up. |
gsm data | Modifies data connection state. Values can be:
searching : searching networks.denied : emergency calls only. |
gsm voice | Modifies voice connection state. Values can be:
|
gsm status | Displays the current status of the GSM emulation. |
gsm signal {rssi} {ber} {rs_snr} | Changes the reported strength and error rate on next (15s) update.
|
cdma ssource {ssource} | Sets the current CDMA subscription source. Values can be:
|
cdma prl_version {version} | Dumps the current PRL version. |
sms send {phone_number} {message} | Simulates an incoming text message from a given phone number. |
sms pdu {hexstring} | Simulates a new incoming text message defined in the PDU format. |
# Interacting with Genymotion
The commands below allow you to perform actions related to the Genymotion application via Genymotion Shell:
Command | Result |
---|---|
genymotion capabilities | Returns Genymotion features available on the selected virtual device. |
genymotion clearcache | Clears temporary files and logs. |
genymotion version | Returns the Genymotion version of the selected virtual device. |
genymotion license | Returns information about the Genymotion license (type, validity). |
# Using Genymotion Shell from a command prompt or script
You can connect to Genymotion Shell and interact with a virtual device from a command prompt or in a script.
Options below are specific to the command line interface:
Option | Value | Result |
---|---|---|
-q | 3.2 Remove header in output. This option makes Genyshell output less verbose and easier to integrate in scripts. | |
-h | Displays the list of available options. | |
-r | {ip_address} | Connects to a given virtual device. |
-c | "{command}" | Runs the command on the selected virtual device and returns corresponding values. |
-f | {file} | Runs the content of the file on the selected virtual device and returns corresponding values line by line. |