Minimum working example for fitbit4j


Update: I build a complete project with Maven now that you can check out at my github repository. Feel free to fork the repository and build on it.


Yesterday someone asked me to help out with the first steps with the Fitbit API and fitbit4j. And although I think fitbit4j is bloated almost to unusability I wanted to verify my sentiments and try to build a simple example application that reads out basic data. This should be a very easy tutorial for the Fitbit API.

Here is what I got after revisiting the help I got from the development group when I started:

Make sure your fitbit application is setup as a desktop application to give you the PIN. The output of the application will show your display name and the registration date on fitbit.com.

This is the most basic application that has access to the Fitbit API using their own library. Isn’t that a little too much just to get data from a REST API? They’re forcing a FitbitApiCredentialsCache, a FitbitAPIEntityCache, a FitbitApiSubscriptionStorage and the instantiation of a FitbitAPIClientService<FitbitApiClientAgent> down my throat. Compare that to the same actions in Ruby:

Much cleaner. Just avoiding all the boilerplate about the caches and storages would make fitbit4j so much easier to use. Well, that is exactly the reason why I decided to lern myself some Ruby On Rails while building the fitbit analyzr. No java webapp, no fitbit4j. Since then I never looked back and I’m happily building my application with Rails. :-)

Weitere Artikel

Crossfit Open WOD 17.5

Crossfit Open WOD 17.4

Crossfit Open WOD 17.3

Crossfit Open Workout 17.2

Crossfit Open Workout 17.1

Run Feedbin in your local Kubernetes cluster

Running Threema Web in Docker

Neues Workout Video

Diät Update #1

Workout 21.01.2017