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 is a real quick post as a heads up. The My Tracks guys have just shipped a pretty major update to My Tracks. This update has changed a load of things including how you export tracks for Tracks2Miles to upload them to Dailymile.
I’ve just pushed a real quick update (I hope I’ve not broken anything) with a fix for an interface that changed, without the fix Tracks2Miles will crash when you try to export a workout with the new My Tracks.
I was hoping to ship Tracks2Miles v2.0 at the same time My Tracks v2.0 shipped but I’ve been really busy with work so not been able to get it finished in time. I hope to get it all done over the next few weekends so I can get it out soon.
Exporting workouts has got a little bit more convoluted with the new My Tracks so I’ll try and do a new walk through video as well.
After my last My Tracks patch had to be pulled (to be honest it did break sharing routes by anything other than Tracks2Miles) a new (safe) patch was accepted a few days ago.
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 =
MyTracksProviderUtils utils =
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.
After discovering that my patch for My Tracks had been pulled just before their last release (1.1.5) I’ve been looking for another way to get the information about time and distance.
After another closer look at the instructions 3rd party use instruction on the wiki and it’s possible to access the My Tracks database directly. Running a query that filters on the workout title, which I can get from the GPX files name, I can get hold of all the information. It is possible to have multiple workouts with the same name so I’m picking the last one added to the db since this has to be the most likely one you’ll be wanting to upload.
Since I’m reading direct from the database there is also the problem that if the My Tracks guys change the table layout then I could have a problem. The API provides a method that returns a Track object which holds the data but you can only use this if you know workout id, but this available at the moment.
I’ll probably stick a new patch in for My Tracks to pass the workout id so I don’t have to make this assumption, but it should be good enough for now.
Other fixes include:
One to stop caching photos in memory before writing them to the sd card to prevent OutOfMemoryErrors
Closed a couple of windows where the database was accessed after it’s been closed.
So it looks like my patch to My Tracks to get it to expose the extra information needed for Tracks2Miles got pulled just before the last release because it broke the export to GMail (and dropbox).
It’s a shame it got spotted so close to the release of My Tracks 1.1.5 I didn’t get chance to look at before it went out.
It looks like Android resolves and unpacks all the Parcellable extras upfront even if they are not used by the receiving Activity or Service. So apps not expecting the Track object I was using fail with ClassNotFoundException because it’s not available.
I’ll try and find some time to come up with a new solution as soon as I get some time to think about it properly.
The latest Tracks2Miles update
Added a timeline view to see what you friends have been up to.
*** Edit ***
I’ve just noticed that on some phones that after the update the launch icon will still open the Activity for publishing a new workout rather than the Timeline Activity. This is a “feature” of some of the launchers, you may need to restart your phone to get it to see the update.
*** Edit ***
Fixed up a couple of race condition type problems.
Updated the code to import from My Tracks to use the patch that has been accepted for the next release.