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.
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:
- Request and display AQI information
- AQI value linked via touch to stored EPA air quality description
- AQI values used the offical color index
- 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
- 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
- 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.
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.