Android Fitness Tracker with Location and Charts
Build an Android fitness app in Java that records walks and runs. It tracks your route with GPS through the Fused Location Provider, keeps recording while the phone is locked using a foreground service, saves every workout in a Room database, and shows your progress over time with charts of distance and pace drawn with MPAndroidChart. You can open any past workout to see its route on a map (using OpenStreetMap, which needs no API key). You'll learn Android location services and permissions, foreground services, Room with background threads, charts, and filtering noisy GPS data.
- Estimate
- ~15.5h
- Steps
- 7
- Completed by
- 0
- Proposed by
- codeseed.app
Android SDK · FusedLocationProvider · Room · MPAndroidChart
Project roadmap
- 01
Set up the project and permissions
~2hCreate an Android project in Java. Add the dependencies for Google Play Services Location, Room and MPAndroidChart. Declare ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, FOREGROUND_SERVICE, FOREGROUND_SERVICE_LOCATION and POST_NOTIFICATIONS in the manifest, and request the runtime permissions with a clear explanation screen, handling denial gracefully. Done when: the app asks for location permission and handles both allow and deny.
- 02
Track location in a foreground service
~3hCreate a TrackingService started as a foreground service with a persistent notification showing the elapsed time and distance. Inside it, request location updates from FusedLocationProviderClient every 2 to 3 seconds at high accuracy. The service keeps running when the app is in the background or the screen is locked, and stops when the user taps Stop. Done when: walking with the screen off still records location updates.
- 03
Record the route and live stats
~2hIn the service, keep the list of route points, ignoring points with an accuracy worse than 25 meters and jumps that would mean an impossible speed. Calculate the distance with Location.distanceTo, and the elapsed time and current pace. Share live updates with the activity through LiveData. Build the tracking screen with Start and Stop, time, distance and pace. Done when: a short walk shows plausible live distance and pace.
- 04
Save workouts in Room
~2hCreate Room entities for Workout (start time, duration, distance, average pace) and RoutePoint (workout id, latitude, longitude, time), with DAOs and a database class. Save the workout and its points when tracking stops, running database work on a background executor, never on the main thread. Done when: finished workouts are saved and still there after restarting the app.
- 05
Build the history screen with charts
~2.5hBuild a history screen with a RecyclerView listing past workouts (date, distance, duration, pace) and two MPAndroidChart charts above it: distance per workout as a bar chart, and average pace over time as a line chart, with readable axis labels and dates. Show a friendly empty state when there are no workouts yet. Done when: after a few workouts, the list and both charts show correct data.
- 06
Show a workout's route on a map
~2hAdd a detail screen for a workout that loads its route points from Room and draws them on a map with the osmdroid library (OpenStreetMap), as a polyline with start and finish markers, zoomed to fit the whole route. Also show the workout's stats. Done when: opening a past workout shows its route on the map.
- 07
Write tests
~2hMove the distance, pace and GPS filtering logic into plain Java classes and test them with JUnit, using hand-made lists of points, including bad-accuracy points and jumps. Write an instrumented Room test using an in-memory database to save and load a workout with its points. Done when: the unit tests and the Room test pass.
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack