You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to listen to a device connection,but I don't know how to obtain a "DeviceClient" object,so I can execute actions on it...I have the DeviceData but it doesn't help me much...
publicasyncTaskStart(){StartServerResultstartServerResult=awaitAdbServer.Instance.StartServerAsync(@"C:\Users\laptop\AppData\Local\Android\Sdk\platform-tools\adb.exe",false,CancellationToken.None);Trace.WriteLine(startServerResult);// result is already runningDeviceMonitordeviceMonitor=null;deviceMonitor=newDeviceMonitor(newAdbSocket(newIPEndPoint(IPAddress.Loopback,AdbClient.AdbServerPort)));deviceMonitor.DeviceConnected+=(sender,e)=>{Trace.WriteLine($"Device connected: {e.Device}");//need to obtain a DeviceClient object,to execute a swipe method.};deviceMonitor.DeviceDisconnected+=(sender,e)=>Trace.WriteLine($"Device disconnected: {e.Device}");deviceMonitor.DeviceChanged+=(sender,e)=>Trace.WriteLine($"Device state changed: {e.Device}{e.OldState} -> {e.NewState}");awaitdeviceMonitor.StartAsync();// Additional code if needed}
The text was updated successfully, but these errors were encountered:
@wherewhere thanks mate!
I know that I can init a new adbclient,but I want to listen in the background for a incoming device connection and disconnection...and the device monitor classs provide me that function....how can I do it with adbclient?
DeviceClient doesn't use IAdbClient. It use IAdbSocket to monitor device list changing. So you need to init an AdbClient by yourself. You can save one as a static property and use it when device list changed.
What can we do for you?
I want to listen to a device connection,but I don't know how to obtain a "DeviceClient" object,so I can execute actions on it...I have the DeviceData but it doesn't help me much...
The text was updated successfully, but these errors were encountered: