Tracks2Miles 1.1.10

Just a quick update while I’m still working on a 2.x release*.

This release has 2 updates:

  1. A small update to the import code to make use of the patch I managed to get included in the latest (1.1.11) release of My Tracks
  2. A new setting in the preferences to block uploading GPX data with a workout imported from My Tracks. This was a feature requested to help people with privacy concerns

You can download Tracks2Miles here: https://market.android.com/details?id=uk.me.hardill.dailymile

* The plan is for 2.x to have a updated UI making use of fragments for tablet and ICS devices.

New My Tracks Patch

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 = 
    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.