A comprehensive Android fitness tracking application built with Kotlin, Jetpack Compose, and Firebase. Track your runs, walks, and cycling activities with real-time GPS tracking, weather data, and cloud sync.
- Real-time GPS tracking with Mapbox integration
- Multiple activity types: Running, Walking, Cycling
- Live statistics: Distance, duration, pace, calories burned
- Route visualization with polyline overlay on maps
- Step counting using device sensors
- Weather data capture at activity start (temperature, humidity, wind speed)
- Google Sign-In authentication
- Automatic cloud backup - activities sync to Firebase when signed in
- Cross-device sync - access your activities on any device
- Offline-first architecture - works without internet, syncs when available
- Account switching - data isolated per user account
- Social feed - view public activities from all users
- Share activities - make individual activities public
- Privacy controls - activities are private by default
- Activity history with detailed view
- Weekly/Monthly charts showing distance and trends
- Statistics dashboard with total distance, duration, calories
- Material 3 design with dynamic theming
- Dark/Light mode support
- Bottom navigation (Home, Social, Statistics)
- Pull-to-refresh on feeds
- Persistent tracking notification during activities
app/
├── data/
│ ├── local/ # Room database (DAOs, entities)
│ ├── remote/ # API services (Weather)
│ └── repository/ # Repository implementations
├── di/ # Hilt dependency injection modules
├── domain/
│ ├── model/ # Domain models
│ └── repository/ # Repository interfaces
├── service/ # Foreground tracking service
├── ui/
│ ├── component/ # Reusable Compose components
│ ├── navigation/ # Navigation graph
│ ├── screen/ # Screen composables & ViewModels
│ └── theme/ # Material 3 theming
└── util/ # Utility classes
- Kotlin - Primary language
- Jetpack Compose - UI framework
- Hilt - Dependency injection
- Room - Local database
- Firebase Auth - Google Sign-In
- Firebase Firestore - Cloud database
- Mapbox SDK - Maps and location
- Vico - Charts library
- Coroutines & Flow - Async operations
Complete activity → Save to Room DB → Background sync to Firestore → Mark as synced
Google Sign-In → Clear local DB → Restore user's activities from Firestore
- Local database cleared on sign-in to prevent data mixing
- Each user's data is completely isolated
- All data backed up to cloud before clearing
users/
└── {userId}/
└── activities/
└── {startTime}/
├── type, distance, duration, calories
├── weather data
└── locationPoints[]
public_activities/
└── {docId}/
├── userId, userDisplayName
├── activity data
└── locationPoints[]
- Android Studio Hedgehog or later
- JDK 17+
- Google account for Firebase
-
Clone the repository
git clone <repository-url> cd mobile_final
-
Firebase Setup
- Create a Firebase project at Firebase Console
- Enable Authentication (Google Sign-In)
- Enable Cloud Firestore
- Download
google-services.jsonand place inapp/
-
Mapbox Setup
- Get API token from Mapbox
- Add to
local.properties:MAPBOX_DOWNLOADS_TOKEN=your_token_here
-
Build & Run
./gradlew assembleDebug
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// User's private data
match /users/{userId}/activities/{activityId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// Public activities (read by anyone, write by owner)
match /public_activities/{docId} {
allow read: if true;
allow write: if request.auth != null;
}
}
}The app requires the following permissions:
ACCESS_FINE_LOCATION- GPS trackingACCESS_COARSE_LOCATION- Location servicesFOREGROUND_SERVICE- Background trackingACTIVITY_RECOGNITION- Step countingINTERNET- Cloud syncPOST_NOTIFICATIONS- Tracking notifications
This project is for educational purposes.
- Mapbox for maps SDK
- Firebase for backend services
- Vico for charts
- Open-Meteo for weather API