-
Notifications
You must be signed in to change notification settings - Fork 2
app intents README
Declare and register app intents (Siri Shortcuts / Android App Actions) from shared Kotlin code.
cmp-app-intents lets you declare your app's Siri Shortcuts, Android App Actions, and Spotlight
search contributions from a single Kotlin DSL. On iOS/macOS it generates the required
AppIntents manifest and bridges to Swift via CmpAppIntentBridge. On Android it registers
intents with the on-device registry. On JVM, JS, and wasmJs it provides invokeForTesting
so you can drive intent execution in tests or demos without a real device.
Experimental API: annotated with
@ExperimentalAppIntentsApi. Opt in with@OptIn(ExperimentalAppIntentsApi::class)or the compiler flag below.
| Platform | Real impl | onUnsupported |
Notes |
|---|---|---|---|
| Android | ✅ | — | On-device registry via App Actions XML + runtime binding |
| iOS | ✅ | — | Manifest + Swift bridge; Spotlight requires real-device verification |
| macOS | ✅ | — | Same manifest + Swift bridge as iOS |
| JVM | ✅ invokeForTesting | — | No OS integration; intents run in-process for tests/demos |
| JS | ✅ invokeForTesting | — | No OS integration; intents run in-process for tests/demos |
| wasmJs | ✅ invokeForTesting | — | No OS integration; intents run in-process for tests/demos |
| tvOS | ✅ registry + manifest | — | Siri Suggestions on Apple TV (tvOS 14+); CoreSpotlight skipped via #if canImport(CoreSpotlight) guard |
| watchOS | ✅ registry + manifest | — | Shortcuts on Apple Watch (watchOS 10+); same Swift bridge as iOS, Spotlight skipped |
| Linux | ✅ registry-only | — |
invokeForTesting() works; no native Shortcuts equivalent on Linux |
| mingw | ✅ registry-only | — |
invokeForTesting() works; no native Shortcuts equivalent on Windows |
| wasmWasi | ⛔ out-of-scope | — | No UI surface — server-side WASM only |
v0.2 update (v3.3.0): tier-3 targets now register intents into the in-memory
AppIntentsRuntimeregistry soinvokeForTesting()works on every platform. watchOS gets full Swift-bridge App Intents support (watchOS 10+ Shortcuts); tvOS partial via Siri Suggestions. CoreSpotlight indexing silently skips on tvOS/watchOS via#if canImport(CoreSpotlight)guards inCmpAppIntentBridge.swift.wasmWasistays out-of-scope — genuinely no UI surface.
@OptIn(ExperimentalAppIntentsApi::class)
fun registerIntents() {
AppIntents.register(
appIntents {
intent("search_products") {
title("Search Products")
param("query") { type = ParamType.String }
handler { params ->
val query = params["query"] as? String ?: ""
AppIntentResult.Snippet("Results for: $query")
}
}
intent("open_dashboard") {
title("Open Dashboard")
handler { AppIntentResult.Done }
}
}
)
}@ExperimentalAppIntentsApi
expect object AppIntents {
fun register(config: AppIntentsConfig)
suspend fun invokeForTesting(
id: String,
params: Map<String, Any> = emptyMap()
): AppIntentResult?
}fun appIntents(block: AppIntentsBuilder.() -> Unit): AppIntentsConfigclass AppIntentsBuilder {
fun intent(id: String, block: AppIntentBuilder.() -> Unit)
}class AppIntentBuilder {
fun title(text: String)
fun param(name: String, block: ParamBuilder.() -> Unit)
fun handler(block: suspend (params: Map<String, Any>) -> AppIntentResult)
}enum class ParamType {
String, Int, Boolean, Double, Entity
}sealed class AppIntentResult {
data class Dialog(val message: String) : AppIntentResult()
data class Snippet(val markdown: String) : AppIntentResult()
object Done : AppIntentResult()
data class Failed(val message: String) : AppIntentResult()
}-
iOS Spotlight:
invokeForTestingworks on Simulator; Spotlight index surfacing requires verification on a real device with Siri enabled. -
Android: App Actions require
shortcuts.xmlin the app module —cmp-app-intentsgenerates this at build time from your registered config. -
Swift bridge: copy
cmp-app-intents/swift/CmpAppIntentBridge.swiftinto youriosAppXcode target — see SETUP.md Step 4.
- SETUP.md — Integration steps (includes iOS Swift bridge installation)
-
CLAUDE_AI_SETUP.md — AI-assisted setup with
/sync-app-intents
** Partials**
App Intents
Bubble
Clipboard
Cookbook
- Clipboard Copy Text
- Clipboard Read Text
- Consumer Anon Key Setup
- Crashlytics Attribution Per Library
- Ifonline Block
- Index
- Index
- Index
- Index
- Open Url Compose
- Pick And Share Image
- React To Offline
- Register Firebase Hooks
- Share Pdf Android
- Share Text
- Wifi Vs Cellular
Firebase Analytics
In App Update
Intent Launcher
Inter App Comms
Modules
- Cmp App Intents
- Cmp App Intents Compose
- Cmp Bubble
- Cmp Clipboard
- Cmp Deep Link
- Cmp Firebase Analytics
- Cmp In App Update
- Cmp Intent Launcher
- Cmp Intent Launcher Compose
- Cmp Library
- Cmp Network Monitor
- Cmp Network Monitor Compose
- Cmp Observe
- Cmp Observe Koin
- Cmp Open Url
- Cmp Pdf Generator
- Cmp Product Tickets
- Cmp Remote Config
- Cmp Share
- Cmp Share Compose
- Cmp Toast
Network Monitor
Open Url
Pdf Generator
Remote Config
Share
Toast
User Tickets
General