AppFunctions 개요  |  AI  |  Android Developers
Blog

AppFunctions 개요  |  AI  |  Android Developers

2026.05.18
·Web·by Homin.Lee
#AI#Android#AppFunctions#Jetpack#MCP

Key Points

  • 1AppFunctions is an Android platform API and Jetpack library that allows applications to expose their on-device functionalities as "tools" for AI agents and assistants like Google Gemini.
  • 2This enables agents to automate tasks and streamline complex cross-app workflows by interpreting natural language commands, often eliminating the need for manual user interface navigation.
  • 3Developers define these functions via annotations, which are indexed by the Android OS for agent discovery and execution, with the feature currently being experimental and in private preview for trusted testers.

AppFunctions is a new Jetpack library and Android platform API designed to enable Android applications to expose their functionalities as "tools" for AI agents and assistants, such as Google Gemini. This mechanism allows users to automate tasks and streamline interactions using natural language, often bypassing the need for manual UI navigation.

Core Methodology and Technical Architecture:

AppFunctions function as the mobile, on-device equivalent of Model Context Protocol (MCP) tools, which traditionally standardize how agents connect to server-side tools. Unlike server-side MCP solutions that rely on cloud execution and network round-trips, AppFunctions execute locally on the device, leveraging the existing app state directly and eliminating the need for external service maintenance.

The technical workflow involves several key stages:

  1. Declaration: Android applications define their callable functionalities using the @AppFunction annotation on Kotlin suspend functions. These functions encapsulate a specific action (e.g., creating a task, searching emails) and declare parameters (e.g., title, query, dueDateTime) and return types (e.g., Task, Playlist, List<EmailSummary>List<EmailSummary>). The isDescribedByKDoc=trueisDescribedByKDoc = true parameter indicates that the function's Kotlin documentation (KDoc) provides the descriptive metadata for agents.
  • Example signature:
kotlin@AppFunction(isDescribedByKDoc = true) suspend fun createTask( context: AppFunctionContext, title: String, dueDateTime: LocalDateTime? = null, location: String? = null ): Task

  1. Schema Generation: The AppFunctions Jetpack library, via an annotation processor, automatically generates an XML schema file (app_functions_schema.xml). This schema enumerates all @AppFunction-annotated functions within the app, detailing their names, parameters, and return types, derived from their Kotlin signatures and KDoc.
  1. OS-level Indexing: The Android OS uses this generated XML schema to build an internal registry (index) of all available AppFunctions from installed applications. This central registry allows system-level components to discover app capabilities.
  1. Metadata Discovery: AI agents or authorized callers can query the Android OS's registry to retrieve metadata about registered AppFunctions. This metadata enables agents to understand the purpose and parameters of each available tool.
  1. Function Selection and Execution:
    • Upon receiving a user's natural language request (e.g., "Remind me to pick up a package at work at 5 PM today"), an agent parses the intent and identifies the most appropriate AppFunction (e.g., createTask).
    • The agent then extracts relevant parameters from the user's prompt (e.g., title="Pickupmypackage"title="Pick up my package", dueDateTime="today5PM"dueDateTime="today 5 PM", location="Work"location="Work").
    • To execute an AppFunction, the calling agent or application must possess the android.permission.EXECUTE_APP_FUNCTIONS permission.
    • Callers utilize the AppFunctionManager to verify device support for AppFunctions and to check if a specific function within a target app is enabled via isAppFunctionEnabled(packageName, functionId).
    • The selected AppFunction is then invoked and executed locally within the context of the target Android application.
    • For custom data types returned by or used within AppFunctions (e.g., Note, Task), they must be annotated with @AppFunctionSerializable(isDescribedByKDoc=true)@AppFunctionSerializable(isDescribedByKDoc = true) to ensure proper serialization and deserialization across process boundaries.
  • Example of AppFunctionSerializable:
kotlin@AppFunctionSerializable(isDescribedByKDoc = true) data class Note( val id: Int, val title: String, val content: String )

AppFunctions are available on Android 16 and later devices and are currently in an experimental private preview phase for trusted testers, with a public release planned for the future. Developers can prepare their apps by implementing AppFunctions now and verifying their registration using adb shell cmd app_function list-app-functions.