Android - telnet script session for sending GPS tracks

All,

I am familiar with the ability to fake GPS information in an emulator using a command geo fix long lat altitudewhen connected through an emulator.

What I would like to do is a simulation running on a potentially different computer, a producer of lat, long, the heights that must be sent to the Android device in order to fake the emulator, thinking that it received a GPS update.

I see various solutions for telnet session scripts ; seems like the best solution, 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 a Mac (not Windows). Is there a better way to do this? (I cannot generate tracks ahead of time and feed them as a route, the Android system is part of real-time simulation, but since it runs on the emulator, there are no location updates. Another system is responsible for calculating these location updates).

edit: An alternative method, perhaps cleaner, is to use the telnetlib library for python.

import telnetlib
tn = telnetlib.Telnet("localhost",5554)
while True:
    if position update generated / received
        tn.write("geo fix longitude latitude altitude\r\n")
+3
source share
3 answers

Perhaps this is close to what you are looking for

https://github.com/xperimental/fakegps

+1
source

Netcat (nc ) , Android.

, , unix, .

, , netcat.

+1

- netcat while (true).

, , PHP () . , , , b/c , / ( , ).

Netcat: TCP/IP

C ... .

Android NDK.

0

Source: https://habr.com/ru/post/1757888/


All Articles