Strava stopped supporting their V1 & V2 APIs and is only allowing select partners to use their V3 APIs. Windows Phone does not have an official Strava app, so any apps being used stopped working without having another fully integrated option to upload your data directly to Strava from your phone.
I used a specific app called Chaser, and I had a ride recorded the day they turned off the V2 APIs. I did not want to lose this data, so I went out searching for a way to collect this data. The App had no way built in to do this. This article will explain how you can get the data off of your phone and in the correct format (.GPX) to upload correctly to Strava.
Many apps for the Windows Phone are only supported via 3rd parties. Unfortunately this means that is likely that this happens to other apps as while. Some of the information in this post may be useful to you to grab the data off of your phone. The example of deserializing the JSON and serializing it to XML may possibly be useful to; although the implementation would be different; the same general paradigm would apply.
There is no way to access the internal storage for Apps on a Windows Phone. In order to get the data off of the phone, I used Fiddler as a proxy to the phone.
Using Fiddler as a proxy allows you to see all of the HTTP network traffic being sent to your cellphone. Since the Chaser app just sends a JSON blob containing all of the ride information to Strava without doing any verification of the authentication token first, you can easily get all of the data for the ride .
Once you get the data, it is in some non-standard format. There is a common GPS data format called .GPX. Many websites support GPX and the standard is published along with a schema. We will reformat the data into a .GPX file which you can then upload to Strava or any other site which takes .GPX data.
Steps to set up the proxy
1) Install Fiddler - If you don't already have Fiddler installed, you can use this link to install it on your desktop PC.
I install the 4.0 version, but I think the other versions should work just as well.
2) Configure Fiddler as a proxy and set Windows Phone to go through the proxy - There are some great instructions on how to do this at the fiddler website. These instructions worked just fine for me as well on Windows Phone 8. I had to have the desktop PC connected to Ethernet in order to get this to work, not sure if this will be the case for everyone.
3) Launch Fiddler - Once you run fiddler it will now be acting as the proxy and you should be able to see all the HTTP traffic from the phone on your computer. Go ahead and test it now by going to any webpage on your Windows Phone and make sure you can see the data in Fiddler.
Capturing the data
1) Try to Upload the data - Once you have the phone setup as a proxy, you can go into the Chaser app and hit the Finish button, followed by the Upload button.
Now that you have the proxy setup you will see the packet containing your ride in Fiddler. All of the data is contained in a JSON blob.
Image of chaser upload screen
2) Save the data - Copy paste the JSON blob from Fiddler to a text file. Depending on how you implement the code below, you can save this to a file, or pass it in as a string to convert it to .gpx.
The data should look something like this:
"activity_name":"Jul Fri 5 14:07 2013",
"data_fields": ["time", "latitude", "longitude"],
"data": [["2013-07-04T00:10:28",47.63803872, -122.12497856],
1) Create a serialization class from the .GPX schema
As I mentioned before, the .GPX schema is open and can be found at http://www.topografix.com/GPX/1/1/gpx.xsd. Visual Studio comes with a command prompt tool for creating serialization classes from a XSD. Download the XSD and then open a visual studio command prompt. You can run the tool with a command line like 'xsd /c gpx.xsd' and it will generate a class file gpx.cs. You can add this file to your project in visual studio and we will use this to convert the data into GPX file data.
2) Deserialize the JSON blob
Once you have the data saved, you will need to convert it to .GPX format. I wrote a quick little helper method in C# to do this.
Serializing the JSON data
object obj = serializer.DeserializeObject(json);
Dictionary<string, object><string,> jsonDictionary = (Dictionary<string, object><string,>)obj;
This will create a loosely typed collection. Each item's key corresponds to the data in the JSON blob before the ':', whereas the object contained in the value is whatever is after the ':' for that object.
Creating the GPX object
I downloaded a .GPX file from Strava to compare how the JSON blob maps to the GPX file. From doing this I was able to determine the structure of the GPX object:
gpxType gpx = new gpxType();
gpx.creator = "Strava JSON to GPX convertor";
gpx.metadata = new metadataType();
gpx.metadata.author = new personType();
gpx.metadata.author.name = "Nigel Stuke";
gpx.version = "1.1";
gpx.trk = new trkType;
gpx.trk = new trkType();
gpx.trk.name = "The name for this ride";
gpx.trk.trkseg = new trksegType;
gpx.trk.trkseg = new trksegType();
This creates the object and instantiates some fields. Some of this data (activity name) could be extracted from the JSON data. But what we mostly care about is the GPS data.
Converting the data
Looking at the JSON blob we can see there are three values: "time", "latitude", and "longitude". We can easily take these values for each data point and plug them into the appropriate type in the GPX file.
object dataObject = jsonDictionary["data"];
object dataObjects = (object)dataObject;
wptType waypoints = Array.ConvertAll(
new Converter<object, wptType>(
object waypointObjects = (object)waypointObject;
DateTime dateTime = Convert.ToDateTime(waypointObjects);
Decimal latitude = Convert.ToDecimal(waypointObjects);
Decimal longitude = Convert.ToDecimal(waypointObjects);
var waypoint = new wptType();
waypoint.time = dateTime;
waypoint.timeSpecified = true;
waypoint.lat = latitude;
waypoint.lon = longitude;
gpx.trk.trkseg.trkpt = waypoints;
This will gives us all the elements from the JSON blob converted to the right data point types for the .GPX format.
Now you have the data as a .GPX object, you can just simply serialize it to a .GPX file, or do whatever else you want with it. This will save you from having to discard your data; you can now import your data via your computer!
using (StreamWriter sw = new StreamWriter("output.gpx"))
XmlSerializer serializer = new XmlSerializer(typeof(gpxType));
In my case I uploaded the new file and was able to see that the ride was plotted and imported correctly to Strava. Hopefully you can use this pattern as well to capture data from your Windows Phone.