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();

WaitForUserAction​

Available starting from ZennoDroid 2.6.1.0.
  • void WaitForUserAction(int timeout)
    Stops the project and hands the device over to a person: a bar with a Continue button appears at the top of the device window, and whatever the template should not do itself can be done on the device by hand. The same as the Waiting for user actions action.

    The project stands on this line until the person presses Continue, until the timeout runs out, or until the template is stopped.

    Parameters:

    • timeout — seconds allowed for the manual work. A negative value waits until the person presses Continue.
  • void WaitForUserAction(int timeout, string comment)
    The same, with a message for the person.

    Parameters:

    • timeout — seconds allowed for the manual work. A negative value waits until the person presses Continue;
    • comment — the text the person sees in the device window. This is where you write what exactly has to be done.

Example​

var action = instance.DroidInstance.Action;

action.WaitForUserAction(120, "Input login and password manually"); // Two minutes for the manual work
var action = instance.DroidInstance.Action;

action.WaitForUserAction(-1); // Wait until the person presses Continue