Fitbit AQI App

Background

I have developed and published a few Fitbit apps. Fitbit apps are developed in JavaScript using Fitbit Studio software development kit. You can develop either apps or clock faces. If you own one of their wearables you can download to your device our use their OS simulator for testing. In most cases where you are planning to support multiple device I find the OS simulator sufficient. Fitbit has some nice guides, tutorials, and references to help you through the process. Some of the online documentation are:

The overall app architecture has a wearable device app that has access to the device’s sensors such as heart rate and accelerometer. Although not not required, a companion app can run on the user’s phone to configure the app settings (e.g. API key), provide additional sensors (e.g. GPS), and provide a gateway to the Internet. The interface between the device and companion apps can use either a Messaging API for synchronous socket based commutations or a File-Transfer API for an asynchronous mechanism for sending binary or text files.

Basic Fitbit App Architecture

Implementation

For my Air Quality Index app I used an API provide by AirNow, which is a one-stop source for all air quality data. They have both online interactive data as well as a developer API. The API returns a JSON formatted string. The system architecture used:

  • app
    • Request and display AQI information
    • AQI value linked via touch to stored EPA air quality description
    • AQI values used the offical color index
  • companion
    • Store user’s AirNow API key
    • Use phone GPS for geolocation
    • Request AirNow AQI for the current location via the Internet
      • Requests are made for increasing distances from the user’s current location until data is returned or distance exceeds 250 miles
      • Return AQI data to the wearable app
  • resources
    • Images such as icon and check buttons
    • Styles.css for different font sizes and colors
    • Widgets for buttons, panoramic, and pagination
    • Index.gui for data screen locations and AQI descriptions
  • settings
    • Text for entering the API key

Due to AirNow having a restriction on the number of API accesses within a day, the app requires each user to apply for their own API key, which is entered using the Fitbit app settings (see below). The API key must be entered as provided by AirNow and is found after the user logs in on the Web Services tab. Full configuration instructions are found here.

Adding AirNow API Key to App

The app was developed in SDK 4.3 for the all Versa models and Iconic watches. The app was approved by Fitbit and published on August 10, 2022.

Leave a Reply