How to update your Android emulator's position with an external GPS
Assuming that you have an Android emulator running, and listening at the default port (5554). First, you need a script called getGeo.sh that gets the GPGGA line from gpsd running at its usual port. gpspipe attaches to gpsd and we get the line we want, put it in a file:
#!/bin/bash # get nmea from deviceFOO="geo nmea `gpspipe -r -n 10 | grep "GPGGA" | tail -n 1`"
echo ${FOO}
echo ${FOO} > ${HOME}/geo.nmea
Then, second code calls telnet and sends it the contents of the file with the "geo nmea
#!/bin/bash # simulate sending gps info to android emulator${HOME}/bin/getGeo.sh
exec telnet 127.0.0.1 5554 < ${HOME}/geo.nmea > /dev/null &> /dev/null
You could loop it to make refresh the positioning as you walk around with your GPS.
Leave a comment