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 ADB name
void SelectByName(string name)
Parameters:
string name // Pass the ADB name of the device you want to pick.
Example
var action = instance.DroidInstance.Action;
action.SelectByName("adbName");
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.
Start the device you've selected previously
void Start()