在此站点上,我们找到了有关要使用的框架的相关信息:(我们决定使用 Android 2.3)
http://developer.android.com/guide/topics/usb/accessory.html
com.android.future.usb: To support USB accessory mode in Android 2.3.4, the Google APIs add-on library includes the backported USB accessory APIs and they are contained in this namespace. Android 3.1 also supports importing and calling the classes within this namespace to support applications written with the add-on library. This add-on library is a thin wrapper around the android.hardware.usb accessory APIs and does not support USB host mode. If you want to support the widest range of devices that support USB accessory mode, use the add-on library and import this package. It is important to note that not all Android 2.3.4 devices are required to support the USB accessory feature. Each individual device manufacturer decides whether or not to support this capability, which is why you must declare it in your manifest file.
同样在选择正确的 USB 配件 API 部分下,它指出您应该使用 Android 2.3.4 或 Android 3.1 API。
我们正在尝试在基本测试程序中使用以下代码,看看我们是否可以连接到 Sumsung Droid 手机上的 USB 设备。
C#代码:
UsbManager deviceManager = null;
UsbAccessory[] accessories = null;
UsbAccessory accessory = null;
我们尝试了#using Android.Hardware;在 VS 2010 中。
1) 这可能吗? 2) 如何访问 Android usb 命名空间?
我们有很多要重用的 C# 代码,因此用 Java 编写应用程序不是我们的第一选择。有任何想法吗?谢谢!
最佳答案
查看 MonoDroid API,您似乎需要 Android.Hardware.Usb 命名空间。这是我找到它的 API 引用的链接。不过我还没有测试过。
关于c# - 尝试使用 com.android.future.usb.UsbAccessory 和 UsbManager 命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8154989/