I recently switched from Sports Tracker to Runkeeper, because the latter one offers integration with the Pebble smart watch. However both of those refused to work with my Polar heart rate sensor so I ended up with Endomondo. I wanted to keep the Pebble integration, but apparently even though that there are few threads in the interwebs requesting this feature, it does not seem to be in the list for now.
Endomondo does not offer any API to query information, but I noticed that when it’s not the active application it posts a notification with some very useful information. Since I heard that it’s possible for Android application to catch the notification messages posted by other programs, I decided to write my own adapter for Pebble.
It proved to be quite difficult to extract the sent information since it’s wrapped into RemoteView object, which does not provide any useful way to tinker with its contents. Finally I found an example from the Stack Overflow which gives an example how do this. Unfortunately the only way seems to be using introspection which is never recommended but seems to work.
The application gets the following information:
- Duration of exercise
- Calories burned
- Heart rate
The information is sent to Pebble’s built-in sports application, so no extra application slot is used from the watch. Unfortunately the watch app is not customizable. It has a display for pace and speed and neither of those is available from Endomondo, so I’m reusing those fields for calories and pulse. User can toggle between these numbers by pressing the middle button on the watch.
The watch application will start automatically when Endomondo starts pushing notifications. The included Android app only displays some instructions and is required by the Play store. The actual program runs as a service on the phone and it needs to be given access to application notifications from the settings menu.
Application source code is available here: https://gitorious.org/pebblemondo
Installable application is available from the Play store against small support fee: https://play.google.com/store/apps/details?id=com.jannem.pebblemondo
Disclaimer: This application is not associated with Endomondo® or Pebble®