S
S
sheknitrtch2013-05-15 18:26:12
satellite navigation
sheknitrtch, 2013-05-15 18:26:12

How to emulate a USB device in Android when connected to a PC?

I want to write an Android application so that when the phone is connected to the PC, it is defined as an external GPS receiver.
HTC phones have the ability to work in 3G modem mode. If you select “Internet Modem” after connecting via USB, then the computer will detect it as a network card and use it to access the Internet. I want to know if this is possible for GPS. I want to transfer information from the GPS module via USB to a PC.
The documentation has a story about how Android can work with external USB devices or accessories. But that's not what I need.
The forums advise using "Share GPS" or "GPS Over BT". But it's very inconvenient. In the case of the first program, you need to connect the phone via USB, launch the application, do port forwarding on the PC via ADB (that is, you must use the Android SDK), and then create a virtual com port through the Franson GPS Gate application to which GPS data will be transmitted. This is somehow not very convenient.
Tell me if what I want is possible in Java, or using the NDK, or with rooted phones!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DiverUA, 2013-05-16
@DiverUA

Not being an Android programmer, I can advise a simpler, in my opinion, solution: a bundle of software for a virtual com port (for example www.advancedvirtualcomport.com ), and an Android application that will transmit NMEA data over TCP ...
You can use some or a hardware solution: a pair of ftdi adapters to connect rx to tx - a com port will appear on Android and on a PC too. And working with a com port in host mode on Android is easy, you don’t even need root.

S
svd71, 2013-05-16
@svd71

A real GPS receiver is engaged in the fact that text data of a certain format is transmitted via a com port.
The idea proposed by DiverUA fully implements your tasks. You just need to write an android service that acts as a TCP server and, using a virtual com port, supply data for any programs on a PC.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question