Share GPS
Android app for sharing GPS data with mapping applications

Follow this guide for the steps on getting NMEA data from Share GPS to GPSD and Google Earth via the USB connection of the mobile.

Once you have this working, it is possible to automate the connection on USB plug in. Go here for that: Automate Linux USB connections

Initial installation and check out

  1. Obtain these packages or equivalent for your distribution:
    • gpsd - GPS daemon, can connect to TCP sockets
    • gpsd-clients - Helper programs for gpsd that can help with troubleshooting problems
    • android-tools or android-tools-adb - ADB is a must for android usb connections, if your distro does not have one of these packages try downloading the x86 zip straight from google:


      The unzip it in your directory of choice

  2. Ensure the mobile has USB debugging enabled and plug USB into the PC
  3. In Share GPS, create a new connection for NMEA USB. The default port of 50000 should be fine for most.
  4. At a terminal prompt, type:

    adb devices

    You should see the device listed, if it indicates offline or unauthorized, check the mobile to see if authorization is needed and ackknowledge.

    If you had to download the platform-tools and had errors when trying to run, see the troubleshooting section

  5. Use adb to forward mobile tcp port (50000 is default) to PC tcp port 20175 (or another port if desired).

    adb forward tcp:20175 tcp:50000

  6. Start the connection in Share GPS. You should see USB listening in the status.
  7. To test and make sure adb and Share GPS are working, use the nc command to check for data coming through. You should see the NMEA strings coming through after entering the command.

    nc localhost 20175

    Share GPS should now indicate connected. If it does, but no data is seen, then try setting 'Create NMEA in settings and try again
  8. Ctrl-c to get out of netcat. Now test that GPSD can connect to Share GPS.

    gpsd -D5 -N -n -b tcp://localhost:20175

    You should see some connection info followed by the NMEA strings.

    If you are using a RedHat variant and saw something with selinux popup or were using a Debian variant and saw it come up and complain about not being able to bind to the TCP ports, see the troubleshooing section.

  9. Ctrl-C to get out of gpsd. Now run gpsd in the mode you would normally run in.

    gpsd -b tcp://localhost:20175

    You will be back at a command prompt as GPSD will run int the background.
  10. Share GPS will indicate listening as GPSD does not connect until a client connects. Try one of the clients to ensure that works. Use 'xgps' or 'cgps' and ensure it is getting NMEA data.
  11. Now you can connect the GPSD client of your choice. OpenCPN is an example or Navit for navigation. If wanting to use Google Earth try this python script with the desired kml file specified.

    python ./gps.kml

Troubleshooting Issues

  1. For red hat variants, I had to download platform-tools and got the following errors when trying to run 'adb':
    • Error: '/lib/ bad ELF interpreter: No such file or directory' solved by:

      yum install glibc.i686

    • error while loading shared libraries: Solved by:

      yum install

  2. For RedHat variants, I had issue with selinux blocking gpsd from using tcp ports. Whenever I tried to run gpsd, it would pop up a window and give me the option to add a rule allowing it, and I did that. The other option would be to just disable selinux all together. Be sure you understand the consequences before you do that (do the following as root):

    sed -i 's/enforcing/disabled/g' /etc/sysconfig/selinux


  3. For Debian variants, I had issues with it binding to tcp ports. Couldn't figure it out, so I just rebuilt from source as opposed to using the packages. That worked

    sudo apt-get remove gpsd gpsd-clients

    sudo apt-get build-dep gpsd


    or just do a git clone of the latest

    cd gpsd-3.15;sudo scons;sudo scons install

    It should build and install gpsd. Now go back and try again.

Automating connections

Follow this procedure to automate USB connections on plug in:
Automate Linux USB connections