The KERN Android app is a native Java application built with Android Studio. It uses MVVM architecture with Retrofit for networking and LiveData for reactive UI updates. This page covers everything you need to get the project building and running.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jaimegayo/KERNDOCUMENTATION/llms.txt
Use this file to discover all available pages before exploring further.
Requirements
- Android Studio Hedgehog or later
- Android SDK API 24 or higher (minSdk is 24, compileSdk is 36)
- A physical device or emulator running Android 7.0+
- A running instance of the KERN API (see Deploy the KERN API on Vercel)
The step counter feature uses the
TYPE_STEP_COUNTER hardware sensor. This sensor is not available on emulators. You need a physical Android device to test step counting during a workout.Key dependencies
The following libraries are declared inapp/build.gradle.kts:
| Library | Version | Purpose |
|---|---|---|
| Retrofit 2 | 2.9.0 | HTTP client for API requests |
| converter-gson | 2.9.0 | Gson serialization for Retrofit |
| OkHttp | 4.12.0 | Underlying HTTP engine for Retrofit |
| Glide | 4.16.0 | Async image loading and caching |
| MPAndroidChart | v3.1.0 | Volume and progress charts |
| Cloudinary Android | 2.2.0 | Profile avatar uploads |
| Navigation Fragment | 2.7.7 | Fragment navigation between screens |
| Navigation UI | 2.7.7 | Navigation component UI helpers |
| Lifecycle ViewModel | 2.7.0 | MVVM ViewModel support |
| Lifecycle LiveData | 2.7.0 | Reactive data observation |
| Material CalendarView | 2.0.1 | Training calendar on dashboard |
Project structure
Configuring the API base URL
The API base URL is set in the Retrofit builder, typically inside a constants file or theApiClient class in data/remote/. Update it to point to your deployed KERN API before building:
Configuring Cloudinary
Cloudinary credentials are loaded fromlocal.properties at build time via BuildConfig fields. Create or edit local.properties in the project root (this file is excluded from version control):
local.properties
BuildConfig.CLOUDINARY_CLOUD_NAME, BuildConfig.CLOUDINARY_API_KEY, and BuildConfig.CLOUDINARY_UPLOAD_PRESET.
Required Android permissions
The following permissions must be declared inAndroidManifest.xml:
| Permission | Reason |
|---|---|
INTERNET | API calls via Retrofit |
ACTIVITY_RECOGNITION | Access to the step counter sensor |
FOREGROUND_SERVICE | Keeps StepCounterService alive during a workout |
StepCounterService must also be declared as a foreground service in AndroidManifest.xml:
AndroidManifest.xml
Building and running
Open the project in Android Studio
Open Android Studio and choose File → Open, then navigate to the
ProyectoIntermodular directory. Android Studio will detect the Gradle build files automatically.Add local.properties
Create
local.properties in the project root and add your Cloudinary credentials as shown above. Without this file, the build will succeed but avatar uploads will fail at runtime.Sync Gradle
Click File → Sync Project with Gradle Files or wait for Android Studio to prompt you. All dependencies listed in
build.gradle.kts will be downloaded from Maven Central and JitPack.Step counter behaviour
TheStepCounterService runs as an Android foreground service with a persistent notification. This prevents Android from killing the process during a long workout. Steps are counted using the TYPE_STEP_COUNTER sensor, which measures steps taken strictly while the service is active — not a cumulative total from the device boot.