views:

22

answers:

0

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")