在C#中访问Android设备设备、Android

2023-09-09 21:00:21 作者:面具

我使用MAD蜂(管理ADB)库访问亚洲开发银行在C#。我只是试图让连接到PC的设备列表。我收到的设备列表正常,当我使用亚行从命令提示符下,但我在我的C#的形式得到0。 这里的code我试过 -

I am using MAD-Bee(Managed ADB) library to access ADB in C#. I am just trying to get list of devices attached to PC. I am getting list of devices properly when I use ADB from command prompt, but I get 0 in my C# form. Here's the code I've tried -

    AndroidDebugBridge mADB;
    String mAdbPath;
    IList<Device> mDeviceList = null;
    public Form1()
    {
        InitializeComponent();
        mAdbPath = Environment.GetEnvironmentVariable("ANDROID_ROOT");
        mADB = AndroidDebugBridge.CreateBridge(mAdbPath + "\\platform-tools\\adb.exe", true);
        mADB.Start();

        var list = mADB.Devices;
        Console.WriteLine(""+list.Count);
    }

现在的问题是MAD蜜蜂不会对如何开始使用它的任何适当的文件或指导。任何帮助吗?

The problem is MAD-bee doesn't have any proper documentation or guide on how to start with it. Any help in this?

推荐答案

Woops发现现在 -

Woops found it now -

List<Device> devices = AdbHelper.Instance.GetDevices ( AndroidDebugBridge.SocketAddress );

在这些测试中

更多信息,请访问 -

More information is available in these tests -

MadBee测试