Share GPS
Android app for sharing GPS data with mapping applications

Using com0com, it's possible to use a batch file to automate the connection. It is even possible to have the batch file run when plugging in the mobile for USB connections! PLEASE BE SURE YOU HAVE BEEN THROUGH THE MANUAL PROCEDURE AND HAVE IT WORKING BEFORE EXECUTING THIS PROCEDURE. You can find the com0com setup here: com0com setup .

  1. Grab the following zip from the Downloads page: windows-auto.zip
    Unzip in a convenient location.
  2. Edit the file shareGPS.bat and change the variables to match your setup. You need the following:
    • ADB location (USB only)
    • com2tcp location
    • com2tcp IP address (127.0.0.1 if using USB)
    • Local Port (for TCP this will be the Share GPS port)
    • Mobile Port (USB only, Share GPS port)




  3. You should now be able to run shareGPS.bat by double clicking it (it can also be run from the command prompt with the start argument. It will start ADB (for USB connections) and begin port forwarding. Then com2tcp will be started in a command window so you can monitor what is happening. When using USB, be sure you have authorized the computer with the mobile as shown below.



  4. It is now possible to run the mapping application on the com port that was setup during your com0com setup.
  5. If you run shareGPS.bat with a command argument of stop, it will end the com2tcp process and end adb forwarding when using USB.

    shareGPS stop
  6. For USB connections, it is possible to have things setup automatically when the user plugs the mobile in. In the zip package, there are two xml files. These are Task Scheduler export files and with a little editing, these can be used in your setup. One is called when the mobile is plugged in, the other when the mobile is unplugged.
  7. The USB device instance of the mobile is needed. This can be obtained from a couple of places. The best place to look is the Event Viewer after you plug and unplug the phone. Another place to check is the Device Manager, under Portable Devices, the mobile should be there.
    • The Event Viewer is located under Administrative Tools. Check the following log after plugging in and unplugging the phone:
      Application and Service Logs->Microsoft-> Windows->DriverFrameworks-UserMode->Operational

      Check for a 2003 event (during plug in) and 2102 event (during unplug) and look at the USB instance. In the XML view, this will will show under UserData, UMDFHostDevice.

    • When checking Device Manager, select the mobile under portable devices and go to the Details tab. From there select the Device Instance Path.




  8. Now it is possible to edit the XML files with the USB instance found in the previous step. AN IMPORTANT NOTE: You must replace the ampersand sign (&) with & as you will find in the example files.
  9. Edit the location of the ShareGPS.bat script in both xml files as well under the Exec->Command section.
  10. Next, edit the UserId section with your Domain\User or MachineName\User.
  11. Open up Task Scheduler from Administrative tools. Right click on Task Scheduler in left pane and select import. Import both of the files.
  12. Now, when the mobile is inserted, adb will start and begin forwarding, and a command window for com2tcp will open so you can monitor what is happening as you connect. When the mobile is unplugged, the com2tcp window will be killed and adb will revert forwarding.
  13. If having issues, use Task Scheduler to run the tasks and make sure that works. You can also check the History tab of the task to make sure it is getting triggered on USB plug in.