After having to update Tracks2Miles to work with My Tracks v2.0, Erik from TitanXT asked if there was anything that needed doing to make Tracks2TitanXT work as well. It turned out that no changes were needed but the route through My Tracks had changed enough to make creating a new walk through video worth it. So here it is.
This patch passes just the My Tracks track id along with the URL for the exported file in the SHARE intent. The key for the extra reuses the same key that is used by the My Tracks library when sending Broadcasts on starting and stopping recording a new track. The track id can be recovered from the intent with the following code:
long track_id = intent.getLongExtra(getString(R.string.track_id_broadcast_extra), -1);
Once you have the track id then looking up all the details of that track using the My Tracks Library project is trivial (Once you got the user to allow 3rd party apps access).
MyTracksProviderUtils utils = new MyTracksProviderUtilsImpl(this.getContentResolver()); Track track = utils.getTrack(track_id); TripStatistics stats = track.getStatistics(); double totalDistance = stats.getTotalDistance(); long movingTime = stats.getMovingTime(); String cat = track.getCategory(); String desc = track.getDescription(); long lastLocId = utils.getLastLocationId(track_id); Location loc = utils.getLocation(lastLocId);
The latest version of Tracks2TitanXT has already been updated to use this method and Tracks2Miles will get an update for this as well as some better tablet support before the next version of My Tracks ships.
About a month ago I was approached by Erik Morse from TitanXT to ask if I would be prepared to do something similar to Tracks2Miles for his site. At the time he did not have an API available, I said if he could run some thing up I would be prepared to have a look. Last week he sent me the details so I spent some of the long weekend running up a first pass of an app.
It works in much the same way as Tracks2Miles in that it hooks into My Tracks through the “Share with Friends…” option, except as well as supporting GPX files TitanXT supports the uploading of TCX files which also contain heart rate information if you are using one of the Bluetooth heart rate monitors that My Tracks supports.
The first pass is in the Android Market, it needs a few more bits of error handling and some cosmetic changes but I thought I’d let those that want to have play.