Skip to main content

Action API

Description

IDroidActionAPI is designed to manage device/emulator selection and lifecycle in ZennoDroid. Allows you to select a device in various ways and start or stop it.

It mirrors how the Device Actions block works for the Lite/Pro and Enterprise versions.


Methods

SelectByIndex

  • void SelectByIndex(int index)
    Selects a device by its index.

    Parameters:

    • index — numeric device identifier.

Example

var action = instance.DroidInstance.Action;
action.SelectByIndex(0);

SelectByName

  • void SelectByName(string name)
    Selects a device by its internal name.

    Parameters:

    • name — system name of the device.

Example

var action = instance.DroidInstance.Action;
action.SelectByName("deviceName");

SelectByTitle

  • void SelectByTitle(string title)
    Selects a device by its display name.

    Parameters:

    • title — human-readable name of the device.

Example

var action = instance.DroidInstance.Action;
action.SelectByTitle("titleName");

SelectRandom

  • void SelectRandom()
    Selects a random device from all available ones.

Example

var action = instance.DroidInstance.Action;
action.SelectRandom();

  • void SelectRandom(string mask)
    Selects a random device matching a mask.

    Parameters:

    • mask — string pattern for filtering (e.g. part of a name or title).

Example

var action = instance.DroidInstance.Action;
action.SelectRandom("Samsung");

Let's say you have the following devices:

  • Pixel_7_Android14;
  • Samsung_S23_Android14;
  • Xiaomi_RedmiNote12_Android13;
  • Samsung_A51_Android12;
  • Google_Nexus5X_Android8;

The "Samsung" mask will match Samsung_S23_Android14 and Samsung_A51_Android12. After filtering, the method randomly picks one of them.


  • void SelectRandom(IEnumerable<string> source)
    Selects a random device from a given list.

    Parameters:

    • source — collection of device names or identifiers.

Example

var action = instance.DroidInstance.Action;
var devices = new List<string>
{
"Pixel_7_Android14",
"Samsung_S23_Android14",
"Xiaomi_RedmiNote12_Android13",
"Samsung_A51_Android12",
"Google_Nexus5X_Android8"
};
action.SelectRandom(devices);

Start

  • void Start()
    Starts the selected device.

  • void Start(bool applyProfile)
    Starts the device with the option to apply the template profile.

    Parameters:

    • applyProfile — whether to apply the template profile before starting (IMEI, Android ID, etc. from the Current Profile tab).
  • void Start(string captureScreenMethod)
    Starts the device with a specified screen capture method.

    Parameters:

    • captureScreenMethod — screen capture method ("h264", "mjpeg", or "off").
  • void Start(bool applyProfile, string captureScreenMethod)
    Starts the device with a profile and a specified screen capture method.

    Parameters:

    • applyProfile — apply profile;
    • captureScreenMethod — screen capture method ("h264", "mjpeg", or "off").

Example

var action = instance.DroidInstance.Action;
action.SelectByTitle("Name"); // Select the device.
action.Start(); // Start.
var action = instance.DroidInstance.Action;
action.SelectByTitle("Name"); // Select the device.
action.Start(true); // Start using ZennoDroid profile data.
var action = instance.DroidInstance.Action;
action.SelectByTitle("Name"); // Select the device.
action.Start("mjpeg"); // Start with captureScreenMethod.

Stop

  • void Stop()
    Stops the current device.

Example

var action = instance.DroidInstance.Action;
action.SelectByTitle("Name");
action.Stop();