使用 Android 手机控制桌面应用程序
我想构建一个应用程序,其中 Android 手机可以控制桌面应用程序。 当用户的手指位于手机屏幕上时,我只需要将坐标从手机发送到桌面。 但我在网络方面有点困惑,是否应该使用蓝牙、USB 或 wifi(内联网)。
我对蓝牙做了一些研究,在Android手机上进行蓝牙套接字编程应该不成问题,但在桌面端只有几个免费的SDK/库。关于使用什么有什么建议吗?
如果我要使用 USB/电缆,我需要使用 Android 端的哪些 API?
我实际上更熟悉一般的套接字编程(wifi),但我认为它会很慢(如果我错了请纠正我)所以这将是我的最后一个选择。
PS:我也在使用Java作为桌面应用程序,
对于使用什么方法有什么建议吗?或者甚至也许我应该在桌面端使用.net?
谢谢
I want to build an application where an android phone would control a desktop application.
I only need to send coordinates from the phone to the desktop when user's finger is on the phone screen.
But I am kinda confused on the networking side if i should use bluetooth, usb, or wifi (intranet).
I did some research on bluetooth, doing bluetooth socket programming on an android phone shouldn't be a problem, but on the desktop side there are only a few free SDK/library. any suggestion on what to use?
If I were to use USB/cable, What API on the android side I need to use?
I am actually more familiar with general socket programming (wifi), but I think it's going to be slow (correct me if Im wrong) so this would be my last option.
PS: I am using Java for the desktop application too
any suggestions on what method to use? or even maybe I should use .net on the desktop side?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能会发现开源 RemoteDroid 应用程序在创建应用程序时非常有用。它甚至可以做你想做的一切。
源代码位于此处。您可能需要一个 svn 客户端,例如 TortoiseSVN 才能下载它。
You might find the open source RemoteDroid app to be useful in creating your app. It may even do everything that you want.
The source code is here. You may need an svn client like TortoiseSVN in order to download it.
Wifi 可能是最受支持的。
蓝牙需要 PC 端的硬件和驱动程序,
如果线路没有问题,USB 通常看起来是最明智的,但问题是它要求用户在手机上启用“USB 调试”,并且具有 Android 设备SDK 或安装的 adbforward 命令的等效功能,以及手机的兼容 USB 驱动程序。如果是这种情况,您只需将一个端口从 PC 转发到手机,然后让一个 PC 程序连接到环回接口上的该端口,该端口将转发到手机上运行的服务。
您可能可以利用最新版本的 USB 网络共享功能来获得 USB 网络,您可以使用它来连接 PC 和手机上的程序,但您需要修改 PC 驱动程序,这样您就不需要实际上并没有通过手机推送电脑的互联网流量(除非您也想进行网络连接)。
Wifi is probably the most supportable.
Bluetooth requires hardware and drivers on the PC side
USB would ordinarily seem like the most sensible if the wire isn't a problem, but the catch is that it requires that the user enable "USB debugging" on the phone, and have either the android SDK or equivalent functionality to the adb forward command installed, plus a compatible USB driver for the phone. If all that were the case, you'd just forward a port from the PC to the phone and have a pc program connect to that port on the loopback interface which will be forwarded to a service running on the phone.
It's possible you could do something piggybacked on the USB tethering capability of more recent releases to get you a network-over-usb that you could use to connect programs on the PC and phone, but you'd need modified PC drivers so that you don't actually push the PC's internet traffic through the phone (unless you mean to tether as well).