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
{{ message }}
This repository was archived by the owner on Jul 13, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 13, 2026. It is now read-only.
Add ADB device tracking (host:track-devices) for real-time device monitoring #323
Add support for real-time device connection/disconnection monitoring via the ADB daemon socket protocol (host:track-devices-l), similar to what the AndroidSdk.Adbd NuGet package provides.
Motivation
The existing AdbRunner.GetDevicesAsync() does a one-shot adb devices -l call. For IDE extensions and developer tools that need to react immediately when devices connect/disconnect (USB plug, emulator boot, WiFi pairing), polling is suboptimal.
The ADB daemon exposes a host:track-devices-l socket command that pushes device list updates in real-time. This is a well-known protocol used by Android Studio and other tooling.
Currently, consumers like MAUI Sherpa depend on the separate AndroidSdk.Adbd NuGet (from redth/android-tools) for this functionality. Consolidating it into Xamarin.Android.Tools.AndroidSdk would reduce the dependency surface.
Proposed API
`csharp
public class AdbDeviceTracker : IDisposable
{
public AdbDeviceTracker(string? sdkPath = null, int port = 5037);
/// Starts tracking. Calls onDevicesChanged whenever the device list changes.
public Task StartAsync(
Action<IReadOnlyList<AdbDeviceInfo>> onDevicesChanged,
CancellationToken cancellationToken = default);
/// Current snapshot of tracked devices.
public IReadOnlyList<AdbDeviceInfo> CurrentDevices { get; }
public void Dispose();
}
`
Implementation Notes
Connect to localhost:5037 (ADB daemon)
Send host:track-devices-l command
Parse length-prefixed device list updates as they arrive
Auto-reconnect on connection drops with backoff
Reuse existing AdbDeviceInfo model
Related
The AndroidSdk.Adbd NuGet (redth/android-tools) has a working implementation via AdbdClient
The maui-labs CLI does not currently have this feature either
Activity
Add device profiles, skin enumeration, and ADB device tracking
Add ADB device tracking via host:track-devices-l protocol
Add ADB device tracking via host:track-devices-l protocol
Add ADB device tracking via host:track-devices-l protocol