FakeGPS and Editing NMEA .txt files

So I have been doing a lot of work with Virtual Earth and Windows Mobile, incorporating GPS as well.  FakeGPS is an excellent tool to help GPS development but with one challenge:  How do you change the reported locations?

The FakeGPS tool reads from text files located in the GPSFiles folder where FakeGPS is installed on the device.


The files are in NMEA file format, reporting locations in the Seattle area.  There are a bunch of links out there that talk about the file format but I found this page to be useful.


It explains the format and provides some examples.  What I did is grabbed a few sample entries from the file to create this sample file. I primarily looked at the entry for GPRMC, GPGGA, and GPGGLL at the above link to change the date, time, and location values for the entry. 


You can modify this to generate GPS data for your desired location.  the bold items are either a UTC time or a date.  To help you interpret the values, the value of 053729 is UTC time in HHMMSS format.  The value of 131008 is October 13th, 2008 in DDMMYY format. 

The latitude data is in red and the longitude data is in green in the above example.  As an example, 3203.156,N represents 32 degrees, 03.156 minutes N.  08104.482,W represents 081 degrees, 04.482 minutes West. 

You will normally see latitude and longitude represented as something like this 32.2432 N and 081.1234 W (west and south are negative values) so you will have to convert between the float value and the degrees / minutes value.

The last thing I wanted to mention is that there is normally a checksum on the lines that end in an asterisk (*) in the file above.  The checksum value represents all of the characters between the $ and * XOR'd.  I was lazy and tested the file by simply leaving the checksum value off and it worked fine with FakeGPS.  So if you have another file that you want to modify, be sure to delete the checksum value after the asterisk.

Comments (3)
  1. It’s no secret that I believe location based services via mobile devices will absolutely change

  2. Ripper says:

    I am using the FakeGPS utility on Device Emulator. I was able to install it successfully. I then wrote a small app to test FakeGPS but the code does not seem to be working i.e I dont get the information from the NMEA text files.. as I am supposed to.

    Here’s the code I am using: (App)

    /** START **/

    #define FLAG 1

    HRESULT hr = S_OK;

    GPS_DEVICE gpsDeviceState;

    GPS_POSITION gpsPosition;


    memset(&gpsDeviceState, 0, sizeof(GPS_DEVICE));

    memset(&gpsPosition, 0, sizeof(GPS_POSITION));

    h_GPS = GPSOpenDevice(NULL, NULL, NULL, 0);

    if (!h_GPS)


    RETAILMSG(FLAG, (TEXT("FakeGpsApp:GPSOpenDevice failed!n")));

    return E_FAIL;


    RETAILMSG(FLAG, (TEXT("FakeGpsApp:GPSOpenDevice succeededn")));

    gpsDeviceState.dwVersion = GPS_VERSION_1;

    gpsDeviceState.dwSize = sizeof(GPS_DEVICE);

    if (ERROR_SUCCESS == GPSGetDeviceState(&gpsDeviceState))


    RETAILMSG(FLAG, (TEXT("FakeGpsApp:GPSGetDeviceState succeededn")));

    RETAILMSG(FLAG, (TEXT("ServiceState:%d, DeviceState:%dn"), gpsDeviceState.dwServiceState, gpsDeviceState.dwDeviceState));

    RETAILMSG(FLAG, (TEXT("Prefix:%s, FriendlyName:%sn"), gpsDeviceState.szGPSDriverPrefix, gpsDeviceState.szGPSFriendlyName));




    RETAILMSG(FLAG, (TEXT("FakeGpsApp:GPSGetDeviceState failed!n")));


    gpsPosition.dwVersion = GPS_VERSION_1;

    gpsPosition.dwSize = sizeof(gpsPosition);

    if (ERROR_SUCCESS == GPSGetPosition(h_GPS, &gpsPosition, 10000, 0))


    RETAILMSG(FLAG, (TEXT("FakeGpsApp:GPSGetPosition succeededn")));

    RETAILMSG(FLAG, (TEXT("ValidFields:%d, SatelliteCount:%dn"), gpsPosition.dwValidFields, gpsPosition.dwSatelliteCount));

    RETAILMSG(FLAG, (TEXT("Latitude:%d, Longitude:%dn"), gpsPosition.dblLatitude, gpsPosition.dblLongitude));




    RETAILMSG(FLAG, (TEXT("FakeGpsApp:GPSGetPosition failed!n")));



    return hr;

    /** END **/

    And the debug msgs that I am getting are:

    /** START **/

    Load module: FakeGPSApp.exe



    FakeGpsApp:GPSOpenDevice succeeded

    FakeGpsApp:GPSGetDeviceState succeeded

    ServiceState:1, DeviceState:1

    Prefix:File, FriendlyName:TestGPSFile

    FakeGpsApp:GPSGetPosition succeeded

    ValidFields:0, SatelliteCount:0

    Latitude:0, Longitude:0



    /** END **/

    Although GPSOpenDevice and GPSGetDeviceState are working fine, GPSGetPostion does not seem to be returning the right values. Am I doing something wrong? I am not sure if this is the right place to post this, any help is appreciated 🙂

    I am using VS2005 to build the app and running it on Windows Mobile 6 Pro emulator. And yes, after installation of FakeGPS, I did enable the FakeGPS app.



Comments are closed.

Skip to main content