Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - scripting telnet session for sending GPS tracks

All,

I am familiar with the ability to fake GPS information to the emulator through the use of the geo fix long lat altitude command when connected through the emulator.

What I'd like to do is have a simulation running on potentially a different computer produce lat, long, altitudes that should be sent over to the Android device to fake the emulator into thinking it has received a GPS update.

I see various solutions for scripting a telnet session; it seems like the best solution is, in pseudocode:

while true:
    if position update generated / received
        open subprocess and call "echo 'geo fix lon lat altitude' | nc localhost 5554"

This seems like a big hack, although it works on Mac (not on Windows). Is there a better way to do this? (I cannot generate the tracks ahead of time and feed them in as a route; the Android system is part of a real time simulation, but as it's running on an emulator there is no position updates. Another system is responsible for calculating these position updates).

edit: Alternative method, perhaps more clean, is to use the telnetlib library of python.

import telnetlib
tn = telnetlib.Telnet("localhost",5554)
while True:
    if position update generated / received
        tn.write("geo fix longitude latitude altitude\r\n")
like image 320
I82Much Avatar asked Dec 15 '25 20:12

I82Much


1 Answers

Maybe this is close to what you're looking for

https://github.com/xperimental/fakegps

like image 173
Eric Fossum Avatar answered Dec 17 '25 15:12

Eric Fossum



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!