在C#中访问Android设备 [英] Accessing android devices in C#

查看:513
本文介绍了在C#中访问Android设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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测试

这篇关于在C#中访问Android设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆