DroidManager API
Description
IDroidManagerAPI is designed for managing the list of devices/emulators in ZennoDroid. It allows you to retrieve information about available devices, work with their identifiers, and perform basic management operations.
Properties
BaseDirectory
-
string BaseDirectory { get; }
Base directory for device data storage.Returns:
Path to the directory where emulator/device data is stored.
Example
return new DroidManager().BaseDirectory;
Methods
ConvertIndexToName
-
string ConvertIndexToName(int index)
Converts a device index to its internal name.Parameters:
index— device index.
Returns:
Device name.
Example
var manager = new DroidManager();
var name = manager.ConvertIndexToName(0); // Internal name of the first device in the list
ConvertIndexToTitle
-
string ConvertIndexToTitle(int index)
Converts a device index to its display name.Parameters:
index— device index.
Returns:
Human-readable device name.
Example
var manager = new DroidManager();
var title = manager.ConvertIndexToTitle(0); // Display title of the first device
ConvertNameToIndex
-
int ConvertNameToIndex(string name)
Converts a device name to its index.Parameters:
name— internal device name.
Returns:
Device index.
Example
var manager = new DroidManager();
var index = manager.ConvertNameToIndex("emulator-5554"); // Device index by its name
ConvertTitleToName
-
string ConvertTitleToName(string title)
Converts a device display name to its internal name.Parameters:
title— display name.
Returns:
Internal device name.
Example
var manager = new DroidManager();
var name = manager.ConvertTitleToName("Samsung_S23"); // Internal device name by its title
GetListDevices
-
IDeviceSummaryInfo[] GetListDevices()
Returns the list of all devices.Returns:
An array ofIDeviceSummaryInfowith summary information about each device.
Example
var manager = new DroidManager();
foreach (var device in manager.GetListDevices())
project.SendInfoToLog(device.Index + " - " + device.Title + ", running: " + device.IsRunning);
GetListIndices
-
int[] GetListIndices()
Returns the list of indices for all devices.Returns:
Array of indices (int[]).
Example
var manager = new DroidManager();
var indices = manager.GetListIndices(); // Indices of every device
project.SendInfoToLog("Devices in the list: " + indices.Length);
GetListNames
-
string[] GetListNames()
Returns the list of names for all devices.Returns:
Array of strings with internal names.
Example
var manager = new DroidManager();
var names = manager.GetListNames(); // Internal names of every device
project.SendInfoToLog(string.Join(", ", names));
GetListTitles
-
string[] GetListTitles()
Returns the list of display names for all devices.Returns:
Array of strings with display names.
Example
var manager = new DroidManager();
var titles = manager.GetListTitles(); // Titles of every device
project.SendInfoToLog(string.Join(", ", titles));
ReconnectOffline
-
void ReconnectOffline()
Attempts to reconnect all offline devices.Description:
Used to restore the connection (e.g. via ADB) to devices that are temporarily unavailable.
Example
var manager = new DroidManager();
manager.ReconnectOffline(); // Try to reconnect every offline device
- Index, name, and title are different representations of the same device:
Index— numeric ID;Name— system name;Title— display name.
- The
ReconnectOffline()method is useful for unstable connections or after restarting ADB.