Ever since I have had Garmin Vívoactive HR, I have planned to implement something for the relatively fresh ConnectIQ platform. Obviously Garmin still has a long way to go to attract enough developers to its platform, whereas Android and iOS are the clear leaders on the smartphone market. This may be tricky, as most of the developers already have been committed to either one of the mentioned platforms, when it comes to the mobile. Moreover, the Garmin Connect IQ apps do not momentarily include mechanisms for charging for the apps. The user is, however, allowed to use his own ways to get money for the apps, e.g. ask for donations, bind the app to an own web site and use some mechanism over there or build an app with extra features that can be unlocked by paying etc. etc.
Before starting with the development, I had already made the preparements a couple of months earlier in order to have a brief look at the platform and its capabilities; a fresh Eclipse installation (Neon) plus the actual Connect IQ SDK with the included simulator and samples. The current SDK version which I used is 2.1.5. The installation adds a new menu to Eclipse (Connect IQ) and setups the paths etc. In the menu there are links to the developer documentation, shortcuts for starting the simulator, exporting the app binary for the device and creating an installation package for the Garmin app store.
There are four main categories of apps supported at the moment: watch faces, data fields, widgets, and apps. I figured out I would like to implement a new data field as it should not be too much effort for the first app. From the first workout with my watch I have wondered why there isn’t a data field indicating the current battery level. This finally led to that I decided to implement one by myself.
As starting point I selected an existing app provided by Garmin and started to modify it to suit my needs. Usually it is recommended that a datafield is inherited from the Ui.SimpleDataField class. This, however, restricts the implementation by removing part of the flexibility, e.g. only black text color is possible. Due to this I chose to use Ui.DataField as basis. Then one has to take care of implementing the functions onUpdate() for updating the actual datafield content and compute() for carrying out the desired calculations. The System API provides data about the current battery level so I basically query for the current value regularly and update the field content accordingly.
Basically I wanted to have a field that simply presents the current battery level in percentage. Additionally it should be able to switch color depending on whether the battery level is high or low. In the first version I hardcoded some threshold values and specified the colors that will be shown for each case. In the second, improved, variant the thresholds and colors were made configurable. For my purposes the data field is adequate: I can follow the current battery level on my watch also during the workout which was the most important thing for me. Obviously the app could be improved in many ways, but let’s see if I have the energy or time to do that. I would like to try to complete some further app ideas first.
The screenshot below shows the app running in the simulator. It is now also available at Garmin App Store.
Update (2016-11-03): I wanted to write something about the Garmin app approval process, but forgot it in the first version of the post. The app submission process itself was pretty simple and straightforward: create a binary file of the app in Eclipse, fill in a description and upload the app for a review. Garmin writes on their web site that it may take up to three days with the approval, but in my case it was about 12 – 18 hours which is pretty good, I think, and immediately after that the app became available in the Garmin app store.
Pingback: Table Hockey Madness (part 1) – Living to run and running to live.