Foundry Local runs chat and speech models directly on Android devices. ChatAppIPC demonstrates
streaming chat and live voice input while inference runs in the Foundry Local service app.
- Connect to the service with
FoundryLocalManager.create(...). - Download and load a chat model through the shared coroutine API.
- Stream chat tokens with
completeChatStreaming(...). - Download and load the Nemotron speech model.
- Capture microphone audio and transcribe it with an
AudioStreamSession. - Clear stale model and client handles when the service disconnects.
Good to know: This sample uses only
com.microsoft.foundrylocal.api.*. It does not use the older IPC callback API,FLResult, or AIDL callback stubs.
-
Download
foundry-local-ipc-sdk-<version>.aarfrom the matching GitHub Release, verify its published SHA-256 hash, and place it in:examples/ipc/ChatAppIPC/libs/ -
Install the Foundry Local service app from Google Play.
-
Build the app from the repository root:
./gradlew :ChatAppIPC:assembleDebug
-
Connect an Android device and install the app:
./gradlew :ChatAppIPC:installDebug
-
Open Chat from the device launcher.
Good to know: Keep only one IPC AAR in the sample's
libs/directory. Gradle loads every AAR in that directory, and multiple versions cause duplicate-class errors.
- Complete the chat model setup.
- Wait for the Nemotron speech model to download and load.
- Grant microphone permission.
- Tap the microphone button and speak.
- Tap stop to copy the final transcript into the chat input.
The chat model is qwen2.5-coder-0.5b-instruct-generic-cpu:4. Voice input uses
nemotron-speech-streaming-en-0.6b-generic-cpu:3, which requires an additional model download.