Controls communication to and from connected Android devices. Use only one instance for the entire project.
Inheritance Hierarchy
RegawMOD.AndroidAndroidController
Namespace: RegawMOD.Android
Assembly: AndroidLib (in AndroidLib.dll) Version: 1.5.2.0 (1.5.2.0)
Syntax
The AndroidController type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| AndroidController | ||
| AndroidController | Initializes a new instance of the AndroidController class |
Methods
| Name | Description | |
|---|---|---|
| CreateResourceDirectories | ||
| Dispose |
Releases all resources used by AndroidController | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| ExtractResources | ||
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
| GetConnectedDevice |
Gets the first Device in the internal collection of devices controlled by AndroidController | |
| GetConnectedDevice(String) |
Gets a Device containing data about a specified Android device.
| |
| GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IsDeviceConnected(String) |
Determines if the Android device with the serial number provided is currently connected
| |
| IsDeviceConnected(Device) |
Determines if the Android device tied to device is currently connected
| |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| ToString | Returns a string that represents the current object. (Inherited from Object.) | |
| UpdateDeviceList |
Updates Internal Device List
| |
| WaitForDevice |
Pauses thread until 1 or more Android devices are connected
|
Fields
| Name | Description | |
|---|---|---|
| _CancelRequest | ||
| ANDROID_CONTROLLER_TMP_FOLDER | ||
| connectedDevices | ||
| Extract_Resources | ||
| instance | ||
| m_eventWatcher | ||
| m_monitorUSB | ||
| resourceDirectory | ||
| RESOURCES |
Properties
| Name | Description | |
|---|---|---|
| CancelWait |
Set to true to cancel a WaitForDevice() method call
| |
| ConnectedDevices |
Gets a List<string> object containing the serial numbers of all connected Android devices
| |
| HasConnectedDevices |
Gets a value indicating if there are any Android devices currently connected
| |
| Instance |
Gets the current AndroidController Instance.
| |
| MonitorUSB |
Gets or sets a value indicating whether this class shall monitor the USB (bus) and automatically check for new devices.
| |
| ResourceDirectory |
Events
| Name | Description | |
|---|---|---|
| OnDeviceAdded |
Occurs when a new Android device is added to the local machine.
| |
| OnDeviceRemoved |
Remarks
AndroidController is the core class in AndroidLib. You must always call the Dispose() method when finished before program exits.
AndroidController specifically controls the Android Debug Bridge Server, and a developer should NEVER try to start/kill the server using an AdbCommand
Examples
// This example demonstrates using AndroidController, and writing the first connected Android device's serial number to the console using System; using RegawMOD.Android; class Program { static void Main(string[] args) { AndroidController android = AndroidController.Instance; Device device; string serialNumber; Console.WriteLine("Waiting For Device..."); // This will wait until a device is connected to the computer // Should ONLY be used in Console applications though, as it freezes WinForm apps android.WaitForDevice(); // Gets first serial number of Device in collection serialNumber = android.ConnectedDevices[0]; // New way to set 'device' to the first Device in the collection device = android.GetConnectedDevice(serialNumber); Console.WriteLine("Connected Device - {0}", device.SerialNumber); android.Dispose(); } } // The example displays the following output: // Waiting For Device... // Connected Device - {serial # here}
See Also