Build an on-device AI fitness tutor app on Android
Introduction
Set up AI Plank Tutor
Get pose landmarks from camera
Add scoring logic for the plank pose
Turn pose data into a prompt for the local LLM
Run the LLM locally with AI Chat
Connect coaching corrections to Android text-to-speech
Explore options for tuning and extending AI Plank Tutor
Next Steps
Build an on-device AI fitness tutor app on Android
What you will build
You’ll build an on-device AI fitness tutor app for Android called AI Plank Tutor.
The app watches a learner hold a plank and compares their body position with a stored instructor reference. It asks a local LLM for one short correction, and speaks the correction using Android text-to-speech.
This project is based on AI Yoga Tutor . You’ll use the same core pipeline, but the project narrows the app to one static pose. By building an app focused on one pose, you can focus on how a pipeline that includes Android camera, pose detector, local LLM, and speech output fits together.
AI Plank Tutor comparing a reference pose with the learner's live plank
The finished app has two main visual areas:
- An instructor plank image on the left.
- A live front-camera preview on the right.
The app overlays a pose score and a short caption that matches the spoken coaching feedback.
You’ll start with a starter project that has MediaPipe and camera integration mostly set up. To learn about this setup from an empty project, see the Build a Hands-Free Selfie Android Application with MediaPipe Learning Path.
App pipeline
The app uses a small pipeline of on-device components:
reference image and camera view
-> CameraX live frames
-> Pose landmarks
-> joint-angle scoring
-> compact text prompt
-> Arm AI Chat + LLM
-> Text-To-Speech
Each stage passes structured data to a subsequent stage. The LLM doesn’t receive camera frames or images. It receives a short text prompt describing the largest joint-angle differences between the learner and the reference plank pose.
This keeps the LLM prompt small, reduces latency, and makes the behavior easier to tune.
Clone the starter project
Clone the Learning Path code example repository:
git clone https://gitlab.arm.com/learning-code-examples/code-examples.git
The starter app for this Learning Path is in code-examples/learning-paths/mobile-graphics-and-gaming/ai-plank-tutor/android.
The starter project contains the app structure, layout, image asset, MediaPipe pose model, and several Kotlin shell files. You’ll fill in the missing code in the following sections.
Open the project in Android Studio
To open the project in Android Studio:
- Start Android Studio.
- Select Open.
- Open
code-examples/learning-paths/mobile-graphics-and-gaming/ai-plank-tutor/android. - Wait for the Gradle sync to finish.
If Android Studio prompts you to trust the project, accept the prompt.
The starter app is intentionally incomplete, but it should sync successfully before you add code.
Inspect the provided files
Start by looking at the provided files.
Open app/build.gradle and confirm that the Android, CameraX, lifecycle, and MediaPipe dependencies are already present.
Arm’s AI Chat dependency isn’t included yet. You’ll add it later when you implement local LLM inference.
Also note the packaging { jniLibs { useLegacyPackaging = true } } setting. The AI Chat library that you’ll add later uses native libraries. This packaging setting lets the app load those libraries correctly.
Open app/src/main/AndroidManifest.xml and confirm that the app requests camera access:
<uses-permission android:name="android.permission.CAMERA" />
The app package is com.arm.demo.AIPlankTutor. You’ll use that package name later when copying the LLM model into the app-specific external files directory with adb.
Open app/src/main/res/layout/activity_main.xml and review the main UI. The layout already contains:
- An
ImageViewfor the instructor plank image. - A
PreviewViewfor the live camera. - A score label.
- A caption label for spoken feedback.
Open app/src/main/res/drawable/plank.jpg and review the instructor reference image.
The code is under the long path app/src/main/java/com/arm/demo/AIPlankTutor. Copy this path exactly, including the capitalized AIPlankTutor package directory. In the directory, open data/PlankPoseData.kt and note the hard-coded plank reference data. This file contains the instructor’s reference landmarks and angle weights used by the scoring step. This was generated from the reference plank image in an offline step, so it doesn’t need any runtime compute.
What you’ve accomplished and what’s next
You’ve now set up the AI Plank Tutor project by downloading a starter project and inspecting the files.
Next, you’ll inspect Android code in the MainActivity.kt file and connect the camera to the MediaPipe pose landmarker.