On this page
Today, if you ask an assistant to "add milk to my shopping list", it either can't or relies on brittle UI automation. AppFunctions lets your app declare a function like addItem(list, item) with structured parameters, so an authorised agent can call it directly, while your app keeps control of the logic.
The androidx.appfunctions library is in alpha (1.0.0-alpha10 as of July 2026), and APIs have changed between alphas. Integration with Gemini was in private preview as of May 2026. Code below shows the shape of the API. Check the release notes for current names before building.
How it fits together
The shape of the API
You annotate functions in a service class, and a KSP compiler (appfunctions-compiler) generates metadata. In recent alphas, functions are declared in an AppFunctionService marked as an entry point. Illustrative only:
// Dependencies (check versions): androidx.appfunctions:appfunctions,
// appfunctions-service, and ksp("androidx.appfunctions:appfunctions-compiler")
@AppFunctionSerializable
data class ShoppingItem(val id: String, val name: String)
class ShoppingFunctions @Inject constructor(private val repo: ShoppingRepository) {
/**
* Adds an item to the user's shopping list.
* @param name The item name, e.g. "milk".
* @return The created item.
*/
@AppFunction
suspend fun addItem(context: AppFunctionContext, name: String): ShoppingItem {
require(name.isNotBlank() && name.length <= 100) // validate model-provided input
return repo.add(name.trim()).let { ShoppingItem(it.id, it.name) }
}
}KDoc descriptions matter: they help the model understand when and how to call your function, as tool descriptions do in function calling.
Designing good app functions
- Expose intents, not UI steps:
createNote(title, body), not "tap FAB, type text". - Small, typed parameters with clear descriptions and validation.
- Idempotency or confirmation for actions with side effects.
- Read functions (search, get status) are lower risk. Start there.
- Reuse your domain layer: functions should call the same use cases as your UI. See Use Cases.
Security and user trust
- Only authorised callers can execute app functions (system-mediated permissions). Don't build custom backdoors.
- Treat parameters as untrusted model output: validate, bound and sanitise.
- Require user confirmation in your app for sensitive actions (payments, deletes, sending messages).
- Respect the user's sign-in state and app-level privacy settings.
- Be mindful of prompt injection: content an agent read elsewhere may try to trigger your functions. See Prompt Injection.
The wider Android AI ecosystem
| Piece | Role | Status (verify current) |
|---|---|---|
| Gemini Nano + ML Kit GenAI APIs | On-device summarise, rewrite, describe, prompt | Beta; device support varies |
| Firebase AI Logic | Cloud Gemini from apps, hybrid inference | GA; hybrid is experimental |
| LiteRT / LiteRT-LM | Run your own models on device | See docs |
| AppFunctions | Let agents act inside your app | Alpha |
| Gemini in Android Studio | AI for developers | Available |
How to prepare now
- Structure business logic as clean, testable use cases, which is good architecture anyway.
- List your app's top user intents that would make sense as voice or agent actions.
- Prototype with the alpha in a branch, behind a flag, and track release notes.
- Design confirmation UX for side-effecting actions.
Frequently asked questions
Is AppFunctions the same as App Actions?
No. App Actions used built-in intents and shortcuts.xml for Assistant. AppFunctions is a newer, function-based mechanism designed for AI agents. Check the docs for migration guidance.
Which devices support it?
AppFunctions relies on platform support in recent Android versions. Check the official docs for current requirements.
Should I ship it in production?
Treat it as experimental while it's alpha: prototype, but expect API changes.
Conclusion
AppFunctions lets apps expose typed capabilities to AI agents, with the system mediating access and your app executing the logic. It's early (alpha), but clean use cases, validated inputs and confirmation for sensitive actions will prepare your app for agent-driven interactions.
Next step: build apps everyone can trust and use with Privacy, Accessibility and Reliability.
Official references
๐ฑ Apps built by Yunok Tech
Real Android apps on Google Play, free to download.
Walzi4K wallpapers for lock and home screenGet it โธ
NotiVaultNotification history: recover dismissed notificationsGet it โธ
Ready to build real Android applications?
Every AI feature still runs inside an Android app that has to be fast, reliable and well structured. Strengthen the Kotlin, Jetpack Compose and architecture skills that AI integrations depend on, then apply these AI concepts with confidence.
Move beyond theory and strengthen your Android development skills with Yunoktech's Android course. Learn core concepts, practical implementation, modern Android development techniques, and the reasoning behind building maintainable applications.
Explore the Android course and take your next step as an Android developer.