如何从 Android 手机获取 GPS 数据?
有没有办法将 Android 手机的 GPS 数据连接(USB 有线)到 PC?我目前正在使用基于 gpsd 项目的 GPSTether 应用程序。
我正在寻找比该应用程序提供更多控制且错误更少的替代方案。另外,是否有另一种方法可以在不使用任何第三方应用程序的情况下执行此操作?
我正在开发一个位置感知软件项目,并希望定期读取 GPS 数据。 GPSTether 应用程序正是通过 telnet 在 TCP 端口上执行此操作。
Is there a method to tether (USB wired) the GPS data from and Android phone to PC? I am using a GPSTether app currently that is based on the gpsd project.
I am loooking for alternatives that give more control and is less buggy than that app. Also, is there another method of doing this without using any third party apps?
I am working on a location aware software project and want to read the GPS data periodically. The GPSTether app does exactly that on a TCP port over telnet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
理想的情况是在 Android 手机和 PC 之间有一个通过 USB 连接的串行端口,并通过手机传输 NMEA。不幸的是,Android 本身并不支持 USB。
GPSTether 是一种“黑客”,使用 adb 转发调试桥来创建手机和 PC 之间的链接,然后从位置管理器读取 NMEA 并通过 adb 转发创建的 TCP/IP 链接发送它。
如果您发现 GPSTether 存在太多问题,那么您实际上只有两个选择:a) 自己实现 GPSTether 版本,或者 b) 提出不同的方法来实现此目的。两者都将涉及相当多的编码。
对于 b),您可能需要考虑 - 当手机作为 USB 大容量存储设备连接到 PC 时,将 NMEA 写入手机上的文件,并定期从 PC 读取文件的更新。
或者,也许您可以为您的 PC 配备一个蓝牙适配器,并使用 Android 应用程序 BlueNMEA 等为 GPS 创建蓝牙 COM 端口连接,通过蓝牙将手机“连接”到 PC。
或者,您可以复制 FTP 客户端程序,然后通过 WiFi 连接将文件写入 PC 上的 FTP 服务器(这将允许您将手机与 PC 放在世界的另一端)。
The ideal situation here would be to have a serial port over USB connection between your Android phone and your PC, and to stream NMEA across it from the phone. Unfortunately Android doesn't support USB in such a way natively.
GPSTether is a "hack" using the adb forwarding debug bridge in order to create the link between phone and PC, and then reads the NMEA from the location manager and sends it over the TCP/IP link created by adb forwarding.
If you are finding GPSTether too buggy, you really only have two choices either a) implement a version of GPSTether yourself, or b) come up with a different method for doing this. Both will involve quite a bit of coding.
For b), you might want to consider - writing NMEA to a file on the phone while it is connected to the PC as a USB Mass Storage device, and reading updates to the file from the PC regularly.
Or perhaps you could get a bluetooth dongle for your PC and "tether" the phone to the PC over bluetooth, by creating a bluetooth COM port connection for the GPS using something like the Android app BlueNMEA.
Or you could copy an FTP client program, and write the file to an FTP server on your PC over a WiFi connection (which would allow you to have the phone on the other side of the world from the PC).
这可以使用 Google Play 市场中提供的 ShareGPS 应用程序和 Franson GPSgate 客户端来完成。您必须使用这些工具将 Android GPS NMEA 信号重定向到 COM 端口。此外,您还需要下载 AndroidSDK 管理器。
有关详细说明,请参阅下面的链接:
http://sharedroid.jillybunch.com/user.html
This can be done using ShareGPS App available in Google Play Market and Franson GPSgate Client. You will have to redirect the android GPS NMEA signal to COM ports using these tools. In addition you will require to download AndroidSDK manager.
For detailed instruction see link below.:
http://sharedroid.jillybunch.com/user.html
使用 Blue-NMEA http://max.kellermann.name/projects/blue-nmea/ 在您的 Android 设备上通过蓝牙或本地 TCP 服务器发送 GPS NMEA 数据,该数据可通过 USB 网络共享或 WI-FI 连接在 PC 上访问。
使用 eterlogic 的 VSPE(虚拟串口仿真器) http://www.eterlogic.com/Products.VSPE .html(查找您的 Windows 版本)并将数据从 tcp 端口重定向到您选择的 com 端口,然后完成设置。现在配置“谷歌地球”、“再见”、“GPS数据记录器”或任何其他软件来监听这个COM端口,这通常是他们自己做的。
Use Blue-NMEA http://max.kellermann.name/projects/blue-nmea/ on your android to send GPS NMEA data on bluetooth or on a local tcp server which can be accessed on PC by usb tethering or on WI-FI connection.
use VSPE (virtual serial port emulator) by eterlogic http://www.eterlogic.com/Products.VSPE.html (look for ur version of windows) and redirect data from tcp port to a com port of your choice and u r done with the settings. now configure 'google earth' ,'see you', 'GPSdata logger' or any other soft to listen to this com port which oftenly they will do by themselves.
http://max.kellermann.name/projects/blue-nmea/
发送 nmea通过 bt com 端口或 TCP 端口。请务必阅读自述文件以避免常见的障碍。
http://max.kellermann.name/projects/blue-nmea/
sends nmea via bt com port or on a tcp port. make sure you read the readme to avoid common obstacles.
这真的很晚了,但我有一台旧的 LG-P350,在设备管理器上它显示了 NMEA 接口。我真的不知道如何使用它。
This is really late, but I have an old LG-P350 and on device manager it shows an NMEA interface. I don't really know how to use it though.