c# - 尝试使用 com.android.future.usb.UsbAccessory 和 UsbManager 命名空间

标签 c# android xamarin.android

在此站点上,我们找到了有关要使用的框架的相关信息:(我们决定使用 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 引用的链接。不过我还没有测试过。

http://docs.xamarin.com/android/api

关于c# - 尝试使用 com.android.future.usb.UsbAccessory 和 UsbManager 命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8154989/

相关文章:

c# - excel互操作替代方案

c# - DateTime[] 和 Object[] 问题

android - 自定义对话框安卓

android - 有没有好的安卓录音库?

c# - 如何使用带有反应式 UI 的 Xamarin Android 将数据绑定(bind)到自定义 ListView

c# - 与 SignalR Hub 的连接失败并显示协商 404(未找到)

c# - Enumerable.ToDictionary<TSource, TKey> 是否执行深层复制?

c# - 我可以使用什么打印机通过 .Net 应用程序进行按需工业打印?

android - 从 ANDROID 设备实时流式传输视频到 OPENCV

android - 从保存的实例启动