Genymotion Shell

Genymotion provides a shell to script the modification of sensor statuses.

Starting Genymotion Shell

To start Genymotion Shell, perform the action corresponding to your operating system:

Windows

C:\Program Files\Genymobile\Genymotion\genyshell.exe

macOS

/Applications/Genymotion Shell.app/Contents/MacOS/genyshell

Linux

~/genymotion/genymotion-shell

or

/opt/genymotion/genymotion-shell

Interacting with Genymotion Shell

With the commands below, you can perform various basic actions related to the use of Genymotion Shell:

| Command | Description | |---------|-------------| | 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|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

The devices command interacts or returns results about virtual devices themselves. Available subcommands are:

| Subcommand | Description | |------------|-------------| | list | Lists available virtual devices and provides details such as current status, IP address and name. | | refresh | Refreshes the virtual device list. | | select <device_ID> | Selects a virtual device. Add the ID of the virtual device you wish to select (as displayed in the device list). | | ping | Sends a ping message to check that the virtual device is responding. | | factoryreset <device_ID> [force] | 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 option force at the end skips the warning message about data loss. |

Example Genymotion Shell > devices list

| Id | Select | Status | Type | IP Address | Name | |----|--------|--------|------|------------|------| | 0 | | Off | virtual | 0.0.0.0 | Samsung Galaxy S8 | | 1 | | Off | virtual | 0.0.0.0 | Samsung Galaxy S9 |

Battery

The battery commands interact with the Battery widget. Available subcommands are:

| Subcommand | Description | |------------|-------------| | getmode | Returns the current battery mode of the selected virtual device. | | setmode <host|manual> | Sets the battery mode of the selected virtual device: host: the virtual battery values reflect the host battery values (if any). manual: the virtual battery charge level and state of charge can be manually set. | | 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. | | setlevel <0-100> | 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. | | getstatus | Returns the current battery state of charge of the selected virtual device. | | setstatus <discharging|charging|notcharging|full> | Sets the battery state of charge of the selected virtual device: discharging <0-100>: simulates that the power supply is unplugged and the battery is discharging. charging <0-100>: simulates that the power supply is plugged in and the battery is charging. notcharging <0-100>: simulates that the power supply has just been unplugged and the battery is not discharging yet. full: simulates that the battery is fully charged. |

Example Genymotion Shell > battery getlevel Battery level: 97%

GPS

The gps command interacts with the GPS widget. Available subcommands are:

| Subcommand | Description | |------------|-------------| | getstatus | Returns the activation status of the GPS signal reception. | | setstatus <enabled|disabled> | Sets the activation status of the GPS signal reception: enabled: the GPS signal reception is enabled. disabled: the GPS signal reception is disabled. | | getlatitude | Returns the current latitude value. | | setlatitude <value> | Sets the latitude value. The value must range from -90° to 90°. | | getlongitude | Returns the current longitude value. | | setlongitude <value> | Sets the longitude value. The value must range from -180° to 180°. | | getaltitude | Returns the current altitude value. | | setaltitude <value> | Sets the altitude value. The value must range from -10000m to 10000m. | | getaccuracy | Returns the current accuracy value. | | setaccuracy <value> | Set the accuracy value. The value must range from 0m to 200m. | | getbearing | Returns the current bearing value. | | setbearing <value> | Sets the bearing value. The value must range from 0° to 359.99°. |

Example Genymotion Shell > gps setstatus enabled GPS status set to: enabled Genymotion Shell > gps setlatitude 50 GPS Latitude set to: 50 Genymotion Shell > gps setlongitude 40 GPS Longitude set to: 40

Rotation

The rotation command interacts with the rotation feature.

Available subcommand is setangle <value> to set the rotation angle value of the virtual device. Value must be 0, 90, 180 or 270 degrees.

Example Genymotion Shell > rotation setangle 180 Device angle of rotation set to: 180

Android

The android command interacts with the Identifiers widget. Available subcommands are:

| Subcommand | Description | |------------|-------------| | version | Returns the Android version of the selected virtual device. | | getandroidid | Returns the Android ID number of the selected virtual device. | | setandroidid <random|custom> | Sets the Android ID number of the selected virtual device: random: a random Android ID number is generated. custom <value>: Sets a custom AndroidID. The value must contain 16 hexadecimal digits. | | getdeviceid | Returns the device ID (IMEI/MEID) number of the selected virtual device. | | setdeviceid <none|random|custom> | Sets the device ID (IMEI/MEID) number of the selected virtual device: none: no device ID number is generated. random: a random device ID number is generated. custom <value>: set a custom device ID. The value must contain alphanumeric characters, dots, dashes and/or underscores. |

Example Genymotion Shell > android version Version: 8.1.0 Genymotion Shell > android getandroidid Android ID: e77d9eeb469a647b

Disk I/O

The diskio command interact with the Disk I/O widget. Available subcommands are:

| Subcommand | Description | |------------|-------------| | 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 <value> | Sets the disk read rate limit in KB/sec. The value must range from 1 to 2097151. Use 0 to disable read rate limit. |

Example Genymotion Shell > diskio getreadratelimit Read byterate is unlimited

Network

The network command interact with the Network widget. Available subcommands are:

Android ≥ 8.0 Android ≤ 7.1

| Subcommand | Description | |------------|-------------| | setstatus <wifi|mobile> <enabled|disabled> | Set the status of the given interface ("wifi" or "mobile"). | | getstatus <wifi|mobile> | Returns the current status of the given interface ("wifi" or "mobile"). | | setsignalstrength <wifi|mobile> <strength> | Set the signal strength of the given interface ("wifi" or "mobile"). Strength values: none, poor, moderate, good, great. | | getsignalstrength <wifi|mobile> | Returns the signal strength of the given interface ("wifi" or "mobile"). | | setmobileprofile <profile> | Set the mobile network profile of the selected virtual device: none, gsm, gprs, edge, umts, hsdpa, lte, 5g, etc. | | getmobileprofile | Returns the current mobile network profile. | | setprofile <profile> | Sets the network profile of the selected virtual device: no-data, gprs, edge, 3g, 4g, 4g-high-losses, 4g-bad-dns, wifi. |

Example Genymotion Shell > network getstatus wifi wifi interface is enabled Genymotion Shell > network setmobileprofile edge Mobile network profile set to edge Genymotion Shell > network setsignalstrength mobile moderate Signal strength for mobile set to moderate

Phone

The phone command interacts with the Phone widget. Available subcommands are:

| Subcommand | Description | |------------|-------------| | call <number> | Simulates an incoming phone call from a given phone number. | | sms <number> <string> | Simulates an incoming text message from a given phone number. | | baseband <subcommand> | Sends raw data directly to the baseband. See table below for available subcommands. |

phone baseband The following phone baseband subcommands will return the corresponding results in your logcat:

| Result | Description | |--------|-------------| | gsm list | Lists all incoming and outgoing phone calls and their state. | | gsm call <number> | Simulates a new incoming call from a given phone number. | | gsm busy <number> | Hangs up an outgoing call (performed from the integrated Dialer application) and reports the remote phone as busy. | | gsm hold <number> | Simulates that an incoming or outgoing phone call (performed from the integrated Dialer application) is put on hold. | | gsm accept <number> | Simulates that the outgoing phone call (performed from the integrated Dialer application) is answered. | | gsm cancel <number> | Simulates that an incoming or outgoing phone call is hung up. | | gsm <data|voice> <value> | Modifies data or voice connection state. Values can be: unregistered or off: no network available. on: on local network, non-roaming. roaming: on roaming network. searching: searching networks. denied: emergency calls only. | | 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: rssi <value>, ber <value>, rs_snr <value>. | | cdma source <nv|ruim> | Sets the current CDMA subscription source: nv: the subscription is read from non-volatile RAM. ruim: the subscription is read from RUIM. | | cdma prl_version <value> | Dumps the current PRL version. | | sms send <number> <string> | Simulates an incoming text message from a given phone number. | | sms pdu <hex_string> | Simulates a new incoming text message defined in the PDU format. |

Example Genymotion Shell > phone baseband sms send 123456789 Hello!

phone baseband (continued)

Interacting with Genymotion

Genymotion

The genymotion command allows you to perform actions related to the Genymotion application via Genymotion Shell.

| Subcommand | Description | |------------|-------------| | capabilities | Returns Genymotion features available on the selected virtual device. | | clearcache | Clears temporary files and logs. | | version | Returns the Genymotion version of the selected virtual device. | | license | Returns information about the Genymotion license (type, validity). |

Example Genymotion Shell > genymotion capabilities { "accelerometer": true, "baseband": true, "battery": true, "camera": true, "deviceid": true, "diskio": true, "gps": true, "network": true, "remote_control": true, "screencast": true }

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 | Description | |--------|-------------| | -q | 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> | Connects to a given virtual device with its IP address. | | -c "<command>" | Runs a command on the selected virtual device and returns corresponding values. | | -f <file> | Runs the content of a file on the selected virtual device. Returns the corresponding values line by line. |

Example ./genyshell -c "battery getlevel" Connection mode: local Welcome to Genymotion Shell

Genymotion virtual device selected: Samsung Galaxy S8_1

Battery level: 100%

Rotation

The rotation command interacts with the rotation feature.

Available subcommand is setangle <value> to set the rotation angle value of the virtual device. Value must be 0, 90, 180 or 270 degrees.

Example Genymotion Shell > rotation setangle 180 Device angle of rotation set to: 180

Android

The android command interacts with the Identifiers widget. Available subcommands are:

| Subcommand | Description | |------------|-------------| | version | Returns the Android version of the selected virtual device. | | getandroidid | Returns the Android ID number of the selected virtual device. | | setandroidid <random|custom> | Sets the Android ID number of the selected virtual device: random: a random Android ID number is generated. custom <value>: Sets a custom AndroidID. The value must contain 16 hexadecimal digits. | | getdeviceid | Returns the device ID (IMEI/MEID) number of the selected virtual device. | | setdeviceid <none|random|custom> | Sets the device ID (IMEI/MEID) number of the selected virtual device: none: no device ID number is generated. random: a random device ID number is generated. custom <value>: set a custom device ID. The value must contain alphanumeric characters, dots, dashes and/or underscores. |

Example Genymotion Shell > android version Version: 8.1.0 Genymotion Shell > android getandroidid Android ID: e77d9eeb469a647b

Disk I/O

The diskio command interacts with the Disk I/O widget. Available subcommands are:

| Subcommand | Description | |------------|-------------| | 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 <value> | Sets the disk read rate limit in KB/sec. The value must range from 1 to 2097151. Use 0 to disable read rate limit. |

Example Genymotion Shell > diskio getreadratelimit Read byte rate is unlimited

Network

The network command interacts with the Network widget. Available subcommands are:

| Subcommand | Description | |------------|-------------| | setstatus <wifi|mobile> <enabled|disabled> | Set the status of the given interface ("wifi" or "mobile"). | | getstatus <wifi|mobile> | Returns the current status of the given interface ("wifi" or "mobile"). | | setsignalstrength <wifi|mobile> <strength> | Set the signal strength of the given interface ("wifi" or "mobile"). Strength values: none, poor, moderate, good and great. | | getsignalstrength <wifi|mobile> | Returns the signal strength of the given interface ("wifi" or "mobile"). | | setmobileprofile <profile> | Set the mobile network profile of the selected virtual device: none (no network connection), gsm (2G GSM), gprs (2G GPRS), edge (2G EDGE), umts (3G UMTS), hsdpa (3G HDSPA), lte (4G LTE), 5g (5G). | | getmobileprofile | Returns the current mobile network profile. | | setprofile <profile> | Sets the network profile of the selected virtual device: no-data, gprs, edge, 3g, 4g, 4g-high-losses, 4g-bad-dns, wifi. |

Example Genymotion Shell > network getstatus wifi wifi interface is enabled Genymotion Shell > network setmobileprofile edge Mobile network profile set to edge Genymotion Shell > network setsignalstrength mobile moderate Signal strength for mobile set to moderate

Phone

The phone command interact with the Phone widget. Available subcommands are:

| Subcommand | Description | |------------|-------------| | call <number> | Simulates an incoming phone call from a given phone number. | | sms <number> <string> | Simulates an incoming text message from a given phone number. | | baseband <subcommand> | Sends raw data directly to the baseband. See table below for available subcommands. |

phone baseband The following phone baseband subcommands will return the corresponding results in your logcat:

| Subcommand | Description | |------------|-------------| | gsm list | Lists all incoming and outgoing phone calls and their state. | | gsm call <number> | Simulates a new incoming call from a given phone number. | | gsm busy <number> | Hangs up an outgoing call (performed from the integrated Dialer application) and reports the remote phone as busy. | | gsm hold <number> | Simulates that an incoming or outgoing phone call (performed from the integrated Dialer application) is put on hold. | | gsm accept <number> | Simulates that the outgoing phone call (performed from the integrated Dialer application) is answered. | | gsm cancel <number> | Simulates that an incoming or outgoing phone call is hung up. | | gsm <data|voice> <value> | Modifies data or voice connection state. Values can be: unregistered or off: no network available. on: on local network, non-roaming. roaming: on roaming network. searching: searching networks. denied: emergency calls only. | | 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: rssi <value>, ber <value>, rs_snr <value>. | | cdma source <nv|ruim> | Sets the current CDMA subscription source. Values can be: nv: the subscription is read from non-volatile RAM. ruim: the subscription is read from RUIM. | | cdma prl_version <value> | Dumps the current PRL version. | | sms send <number> <string> | Simulates an incoming text message from a given phone number. | | sms pdu <hex_string> | Simulates a new incoming text message defined in the PDU format. |

Example Genymotion Shell > phone baseband sms send 123456789 Hello!

phone baseband (examples)

Interacting with Genymotion

Genymotion

The genymotion command allows you to perform actions related to the Genymotion application via Genymotion Shell.

| Subcommand | Description | |------------|-------------| | capabilities | Returns Genymotion features available on the selected virtual device. | | clearcache | Clears temporary files and logs. | | version | Returns the Genymotion version of the selected virtual device. | | license | Returns information about the Genymotion license (type, validity). |

Example Genymotion Shell > genymotion capabilities { "accelerometer": true, "baseband": true, "battery": true, "camera": true, "deviceid": true, "diskio": true, "gps": true, "network": true, "remote_control": true, "screencast": true }

Using Genymotion Shell from a command prompt or script (continued)

Interacting with Genymotion

The genymotion command allows you to perform actions related to the Genymotion application via Genymotion Shell.

Available subcommands are:

Example Genymotion Shell > genymotion capabilities { ... }

Example blocks

Example

Genymotion Shell > battery getlevel

Battery level: 97%

Example Genymotion Shell > gps getstatus wifi GPS status: enabled

Example Genymotion Shell > network getstatus wifi wifi interface is enabled

Using Genymotion Shell from a command prompt or script (final example)

Example

./genyshell -c "battery getlevel"

Connection mode: local host

Welcome to Genymotion Shell

Genymotion virtual device selected: Samsung Galaxy S8_1

Battery level: 100%

Back to top