Skip to main content
HERE360 blog

Build your own fitness app with HERE

Build your own fitness app with HERE

Build your own fitness app with HERE

Fitness apps are changing the way that we keep fit. Offering greater insight into how we exercise, calories burnt and more, these apps are giving us encouragement as well as information. Yet, there is still room for refinement and innovation. Here’s how I created my own fitness app with HERE.

Not so long ago, I received a very thoughtful and quite telling gift from my fiancé – a fitness tracker. I have a fondness for gadgets and had also been slacking off when it came to my fitness program, so it was a useful and timely gift. The tracker encouraged me to take at least 10,000 steps a day, the alleged sweet-spot where you actually start to notice the benefits.

Walk this way

However, I found that my usual working day results in me walking around 8,000 steps, while on weekends it was even lower, so I had to up my efforts to reach my goal. What I found, however, was this wasn’t as easy as it sounds. I started building new routes into my routine, but the repetition became boring.

What I needed was an app – one which allowed me to find interesting destinations within a certain number of steps from my current location. If, for example, I wanted to take in the additional steps needed to reach my goal during my lunchtime walk, an app that showed interesting nearby locations, as well as pedestrian-friendly routes to them, would encourage me to do so.

Thankfully, as the official map provider of the BMW BERLIN MARATHON, HERE has a wealth of experience in providing maps for the more active among us. With this in mind, I decided to build the app myself using the HERE Android Premium SDK, and found that I could do so in less time than it takes to walk 10000 steps.

Step up

First, I had to display a map, which couldn’t be easier - the SDK download already contains a project called ‘BasicMapSolution’ in the tutorials folder (alternatively, turn to our quick start guide.)

Second, I needed to figure out how to display my own location. I started by entering my credentials, something that takes very little time and is highly recommended – just go here for a free 90-day trial. I then used the PositioningManager and PositionIndicator classes, with the former providing details of the device's geographical location, and the latter providing a map marker to show the current position on the map. Take a look at our positioning user guide for more details.

 

The next step was to find somewhere interesting to walk. This is where the Places feature of the SDK comes in handy, allowing you to search for points of interest by creating what’s called an ‘ExploreRequest’ and setting the desired options.

Then, we needed to set the search area, which defines the space in which we are looking for points of interest. This is defined by our current location (provided by the PositioningManager mentioned above), and the range, which should be based on the number of steps the user wants to walk.

Some tinkering was required to convert the number of steps into meters – I found that the easiest way of doing this was by multiplying the number of steps by 0.762. While this isn’t an exact science, it worked well in practice and was straightforward to implement.

Fitness2

Next, I needed to make sure the results I got were appropriate, with our CategoryFilter function enabling me to select the type of results I wanted to get. Take a look at the search & discovery guide to see the wide range of options available.

Seeing results

After establishing the area in which I’d like to travel, I was ready to start my search. To do this I needed to provide what we call a ResultListener which returned a list of ‘PlaceLinks’ for all the ‘sights & museums’ nearby. For more information on how to complete any of these steps, check out this post.

Next, I used something called the MapMarker object to add icons to the map, with each representing the potential walking destinations.

Then we turn to the Routing feature, which has a number of options to help you see the routes available. I used a feature called the RouteManager class, which calculates a route based on the waypoints and RouteOptions that have been set in a RoutePlan.

After adding two waypoints (my location and destination) and selecting ‘PEDESTRIAN’ in the transport options, I was able to calculate the route using RouteManager (check out the Routing Calculation guide for more details).

Now that we’re approaching the finishing line, it’s time to display the results of the route calculation on the map. Thankfully, the already-used RouteManager calls what’s described as a Listener when the route calculation is complete, so this is the perfect place to implement this. For more information, head here.

 

After the final touches – determining the step count, updating the title of the MapMarker with information to display it in an info bubble – the app was good to go. Now, I’m able to hit 10000 steps with ease, while also investigating spots in Berlin I may never have visited. I use it every day, and hope that by using these steps, you can do the same.

You can find the code for this fitness app here, offering a more detailed account that you can work along with. Please note, however, that we cannot offer any support for its implementation or use.

Screenshot 2016-07-05 14.55.23

What features would you like to see included in a fitness app? Let us know in the comments below.

Richard Süselbeck

Richard Süselbeck

Have your say

Sign up for our newsletter

Why sign up:

  • Latest offers and discounts
  • Tailored content delivered weekly
  • Exclusive events
  • One click to unsubscribe