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 device

FOO="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 " line:

#!/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.

Categories

,

Leave a comment


Type the characters you see in the picture above.

About this Entry

This page contains a single entry by Cedric published on December 3, 2009 4:38 AM.

November 9th federal by-election: results maps in 2008 was the previous entry in this blog.

Enfin de retour à Hong Kong is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.