Add OACP to Your App
Five minutes. Three files. One dependency.
You are going to add voice control to your Android app. When you are done, Hark (or any OACP-compatible assistant) can discover your app's capabilities and invoke them by voice.
What you'll add
File | Purpose |
|---|---|
| SDK dependency (provider + helpers) |
| Declares what your app can do |
| Plain-English context for the AI |
| Handles incoming voice commands |
Step 1: Add the SDK
Download oacp-android-release.aar from the latest release. Copy it to app/libs/.
Sync Gradle. The SDK gives you OacpReceiver, OacpMetadataProvider, and parameter-parsing helpers.
Step 2: Create oacp.json
Create app/src/main/assets/oacp.json. This manifest tells assistants what your app can do.
__APPLICATION_ID__ is replaced with your real package name at build time. Don't hardcode it.
More aliases and examples means better voice matching. A capability with 5 aliases and 5 examples resolves much more reliably than one with just a description.
Flutter apps: place the file atandroid/app/src/main/assets/oacp.json, NOT in Flutter'sassets/folder.
Step 3: Create OACP.md
Create app/src/main/assets/OACP.md. This gives the AI assistant context about your app in plain English.
Keep it short. Write it like you are explaining the app to a colleague.
Step 4: Create a BroadcastReceiver
Create a receiver that extends OacpReceiver from the SDK:
setResultSuccess() and setResultError() are helpers from OacpReceiver. The assistant uses the result to give the user feedback.
Step 5: Register in AndroidManifest.xml
The SDK's OacpMetadataProvider is registered automatically via manifest merging. It exposes your oacp.json through a ContentProvider so assistants can discover your app.
Step 6: Verify
Build and install your app, then check that the manifest is discoverable:
Replace com.example.myapp with your actual package name. You should see your oacp.json contents printed back.
If you have Hark installed, long-press Home and say "turn on dark mode." Hark should find your app and dispatch the action.
What's next
- oacp.json reference - Full schema with parameters, confirmation modes, and visibility options
- Kotlin SDK guide - Async results, parameter parsing, and advanced patterns
- Complete integration guide - Multi-capability apps, Activities vs Broadcasts, and Flutter integration