Action API
Please read the Material Usage Rules on this site.
Description
IDroidActionAPI Action
This interface gives you access to device management. You can select, start, and stop a device. It works with both virtual and real phones.
It mirrors how the Device Actions block works for the Lite/Pro and Enterprise versions.
Methods
Select a device by its index
void SelectByIndex(int index)
Parameters:
int index // Pass the index of the device you want to pick.
Example
var action = instance.DroidInstance.Action;
action.SelectByIndex(0);
Select a device by its name
void SelectByName(string name)
Parameters:
string name // Pass the name of the device you want to pick.
Example
var action = instance.DroidInstance.Action;
action.SelectByName("deviceName");
Select a device by its display name
void SelectByTitle(string title)
Parameters:
string title // Pass the title of the device you want to pick.
Example
var action = instance.DroidInstance.Action;
action.SelectByTitle("titleName");
Select a random device from those available
void SelectRandom()
Example
var action = instance.DroidInstance.Action;
action.SelectRandom();
Select a random device that matches a mask
void SelectRandom(string mask)
Parameters:
string mask // Pass the mask you want to use.
Example
var action = instance.DroidInstance.Action;
action.SelectRandom("Samsung");
Let's say you've got these 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 will randomly pick one of these two.
Select a random device from a list
void SelectRandom(IEnumerable<string> source)
Parameters:
IEnumerable<string> source // List of device names/titles to choose from.
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 the device you've selected previously
void Start()
Overload:
bool applyProfile
// Pass True if you want to use data from the ZennoDroid profile.
// Device parameters (IMEI, Android ID, etc.) will be taken from the Current profile tab.
Overload:
string captureScreenMethod // Screen capture method type.
// Options: "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 the selected running device
void Stop()
Example
var action = instance.DroidInstance.Action;
action.SelectByTitle("Name");
action.Stop();