*3.2. Architecture*

The decision to use a combination of a web-based approach and a native app, which requires more-or-less permanent Internet connection, turned out well. Most users in the Netherlands apparently have good Internet connections on their phones. A drawback of our current choice was that integration with third-party APIs (i.e., Fitbit and Facebook authentication) was difficult, since Fitbit does not allow using their authentication API through the WebView. This can be solved with the newer Chrome tabs approach.

We decided to copy the data from Fitbit servers to our own database: a Cron job runs periodically to fetch the data through a web service. The advantage is that we could do our analyses more easily (e.g., summarizing the data for different time periods every hour) and have a good performance when we query the data. A disadvantage is that the information sometimes lags behind. If the performance is sufficient, we would recommend to dynamically invoke a web service at runtime. Another possible solution is the use of the use of more advanced services, such as the Fitbit subscription API, which allows sending notification to our system when new data are available.

Related to the point above, we let participants use the Fitbit app to synchronize their data with the activity tracker. This was necessary because it is not possible to read out the Fitbit device directly. As a consequence, the Fitbit app or a computer was needed in addition to our own system. It also required an additional step in the initialization, as users had to create an account on the Fitbit website. For future applications, direct communication between the coaching system and activity trackers is preferred; however, this is likely not easy with commercially available trackers.

We have decided to partly develop a native app for Android. A native app was necessary for implementing the location detection. New developments in standardization of location detection APIs and more advanced techniques for platform-independent development might result in a different choice, which could enlarge the potential user base. Another option would be to use the Google Fit API for getting information about the activity of users. Since its introduction, many systems and wearables directly integrate with this service.
