New Garmin Service Integration

Garmin recently announced a new Health API for third party developer. Given the issues I have been having extracting activities from the web service with regular changes to the API breaking the app, I jumped on the opportunity to try to have a more robust integration.

The new service does not let you access the activities from your account directly as ConnectStats has been doing via the web site API, instead it is a mechanism to provide the activities into your own service. Which meant that to use it, I would have to host on a server my own service that receives the data, stores it and make it available to the app.

The service is now integrated, and I will have to start rolling it out. I will initially roll it out via Test Flight and ask volunteer to do some testing to make sure the service works. It is quite scary as I could only test it with my set of activities and my Garmin account.

Principles of the integration

It is possible either to start a new profile where all the activities are downloaded from this new service or to only start downloading from this service new activities when you have older activities already downloaded from Garmin. It should handle past duplicate properly.

The data will be synchronised into a database online, but the app will not ask you any identification via email or others. All the data will be referenced via hashed keys linked to Garmin account, and I intend to prevent any access to your data if you didn’t successfully login to the Garmin service. Any way around this is a bug, and I will fix them as they are reported. The web service is also open source so for transparency people can verify I don’t do anything bad or point the bugs out.

There are a couple of short comings from the new service to understand.

History requires slow first synchronisation

When you first enable the service, it will contain no history of your activities. Upon first login, it will trigger a synchronisation of your previous activities with Garmin which is time consuming. It happens at a rate of 90 days per two minutes. So synchronising one year of activities it will takes about 8 minutes.

Also because it is impossible for the app to know how many years to ask in the past, when you setup the account, you’ll need to specify from which year you want to synchronise your activities, which will default from the previous year. If you select many years you’ll need to wait a about 8 minutes per year until the synchronisation is finished.

This is a rate limitation imposed intentionally by the Garmin service, so there is nothing I can do about it.

Only details for activities from the devices currently associated with your account

Currently the service will only provide details (from fit files) for activities that were recorded with a device that is currently associated with your Garmin account. So if you changed devices and unregistered the old device, you will no longer be able to download the detailed fit file and only have access to a summary of the activity.

This is an unintentional issue with the Garmin service, and Garmin support told me they will work on removing the limitation. I’ll update the post when the limitation is removed.

Testing volunteers

I will need some volunteer to test the service. I can’t release widely after just testing on my account. It is likely that there will be some issues initially, but it should be easy to maintain two profiles in the app: one from the current Garmin service and one from the new one for testing. It is also intended to let you switch back an forth between services, if you delete some activities from the app and trigger a synchronisation from the other services, only the missing activities should come from the previous service.

The activities on the Garmin Connect service will NEVER be touched or deleted by anything you do on the ConnectStats app.

You’ll find instruction to test the new build here

Quick update

Many spurious activities continue to be sent by the Garmin Service that connectstats currently uses.

I will likely be able to push a fix for this during the weekend. The good news I anticipate the app will be able to delete all the spurious activities that are sent from the Garmin API.

Garmin is also now providing a new service, which I am working on integrating and will avoid all the Garmin API issues in the future, but this takes time.

Issue with many extra activities downloaded

Just a quick heads up, that many users are reporting that ConnectStats downloading a lot of activities unrelated to their own.

While I initially thought it had to do with Strava, it’s actually an issue with the Garmin service. Currently not consistent and not affecting everyone (it may soon), but I think I understand what the change is and will need to push a new version when I can, hopefully within a week.

Will update further here.

ConnectStats 4.6 released

ConnectStats is now approved and available in the store for update. With version 4.6, the connectivity with Garmin should work again.

On a separate note, I have applied to the new Garmin API and just got approved, so I’ll be working on getting that available for a later version, and hopefully, this should prevent similar unexpected outage in the future.

Quick update on fix timing

I am currently travelling, and somehow, I forgot to copy the key/certificate I need to submit to the apple store on my laptop… So won’t be able to submit the fix until I get back home this weekend and access my iMac… Sorry for the delay.

On a separate news, someone pointed out to me that Garmin is now offering a new API to access data on their service. I just submitted a form and applied to get access. Hopefully ConnectStats will be approved to use that API and it should simplify the app maintenance in the future. Will keep you posted.

April outage

It had been a while, but this week, ConnectStats started to fail to access the data from Garmin’s website due to a change on the API.

As usual, I have removed the app from sales while I sort it out, and disabled the bug reporting.

I have now figured out a fix, and will push it to the store very soon after some testing, likely before this weekend (April 20). As soon as the fix out approved by apple, I’ll put the app back on sales and people should be able to update and get it working again.

Solution to two recent problems

I received quite a bit of feedback on two issues recently, but wasn’t very responsive… My excuse? I was on vacation, Yay!

Error Updating

Since a few days ago, people receive an “error updating”. It will loads the latest activities. but stops, which is both annoying and plain bad if you have more than 20 new activities as it won’t download the remaining. This is due to another API change, the access point ConnectStats uses to download the power zones changed. So as quick fix, I removed the downloading of power zone and will add it back when I have a bit more time. A new version 4.4.2 is on its way with this fix.

Missing old activities

Quite a few people had issues downloading old activities. A new version should address the issue. If you were affected, once you have the new version 4.4.3, you should go to    config, select Current Profile and Force Download Old Activities. This should try to download again everything.


Weather Bug (Crash on import)

Yet another small change in the garmin API (related to the weather), that result in a crash of the app. I have put so many guards around the code for API change, but seems there is always one I am missing..

I am pushing a new version to the store, so hopefully this should fix most of the recently reported crashes.

Important release to correct data import problems

A new version 4.4 is now available.

This fixes the issue around missing data on import, as well as incorrect units for some fields like min or max elevation.

Bad Release Problem Solved!

As a bonus, I added support for Garmin Device Power while running, as least for the devices for which users sent me sample fit files.

Missing Data

Because of my own silly bug, ConnectStats was not trying hard enough to look for all activities on the initial download, and was stopping too early, resulting in missing older activities. This is now fixed in 4.4. But it’s hard for the app to know if it missed old activities or not. So if you think you are in that situation, the best is to force the app to reload all activities, by going to “settings”, selecting “profile” and “Force Reload Old Activities” as below. This will start a download that will try to reload everything, it will also help fix data previously imported with incorrect units.


Incorrect Units

Even though I have build a lot of tests over time, it is always difficult to make sure when a new API changes that the app is behaving properly. This is due to the fact that the API is undocumented and that I have limited scope for testing of new features, given that I do it on my own. I basically only test on my activities and the activities people have sent me over time in the past. Though we should not complain about the lack of documentation given as mentioned in the past, this API is not intended for external use, but just for garmin own website… So I am just grateful Garmin lets ConnectStats continue to use it, even if we just have to reverse engineer everything.

To illustrate the issue and give people a feel for the reason behind some of the bugs, the bad units were due to inconsistencies in the scale of the number depending on which data you were receiving: summary or detail for an activity.

In the summary the elapsed duration data comes as milliseconds:

While in the detail file it comes as seconds…Beside the elapsedDuration, maxElevation and minElevation everything else is consistent… Go figure… These are hard to anticipate and catch when you test on your own, so I want to thank all the users who have the patience to report details about such bugs and also the patience to wait for me to push fixes.


Missing activities bug

A new embarrassing bugs slipped through the release of the new api connectivity… As some users reported, if you try to download from a fresh install, you will miss older activities.

I am quite upset I missed this bug. My testing of the new API was on a test account with a limited number of activities and did not exhibit the issue…

Anyway, I have a fix, and will release soon now.

You can Follow progress here