Android 16 AppFunctions API: A New Mechanism for App Function Exposure and System Integration
Android 16 adds the AppFunctions API, letting apps expose specific functions through an AppFunctionService that the system indexes via AppSearch and invokes with AppFunctionManager, so AI assistants and system search can discover and execute actions like ordering pizza or booking flights while respecting required permissions and threading constraints.
Android 16 introduces the AppFunctions API, a mechanism that allows apps to expose specific functions to the system, which can be integrated into various system features. This API is described as similar to MCP (Model Context Protocol) support on Android, with the primary purpose of enhancing AI applications like Gemini.
For GenAI-type apps, these assistants can seamlessly interact with other installed apps. For example, when a user says "order a pizza from my favorite pizza app," the AI can identify the relevant app and use its exposed "order food" function to initiate the ordering process, even pre-filling information based on user preferences or order history. Similarly, for flight bookings, the AI can navigate the app interface, select dates and destinations, and complete bookings based on stored preferences.
Beyond AI scenarios, AppFunctions can also integrate with system search. For instance, when searching for a KFC restaurant in system search, results might include a "VM50" option provided by the KFC restaurant app.
The core components implementing this functionality are AppFunctionService and AppFunctionManager . AppFunctionService is an abstract base class where developers create subclasses to provide specific app functions. AppFunctionManager provides management functions related to app functions.
When the system needs to execute an app-provided function, it calls the onExecuteFunction method in AppFunctionService . Developers need to implement logic based on the functionIdentifier contained in the ExecuteAppFunctionRequest object. Note that onExecuteFunction runs on the main thread, so time-consuming operations should not be performed. To protect AppFunctionService from being bound by arbitrary apps, developers must declare the service in their AndroidManifest.xml with an intent-filter for action android.app.appfunctions.AppFunctionService and declare the android.permission.BIND_APP_APP_FUNCTION_SERVICE permission.
AppFunctionManager is responsible for managing and scheduling functions exposed by various apps. When packages change or the device starts, AppSearchManager indexes metadata for available functions on the device. AppSearch stores this information as AppFunctionStaticMetadata documents, which contain the functionIdentifier and the app function's architecture information, enabling other apps to discover these functions using AppSearch APIs.
To execute AppFunctions, callers retrieve the functionIdentifier from AppFunctionStaticMetadata documents and use it to build an ExecuteAppFunctionRequest . The request is executed asynchronously via executeAppFunction(ExecuteAppFunctionRequest, Executor, CancellationSignal, OutcomeReceiver) , and callers need to declare the android.permission.EXECUTE_APP_APPLICATIONS permission.
The complete interaction flow involves: 1) App provides AppFunctionService and registers in AndroidManifest.xml; 2) Android system detects new AppFunctionService and indexes its function metadata using App Search; 3) Service consumers (e.g., AI assistants) search for App Functions implementing specific schemas using App Search; 4) Consumers obtain the target App Function's functionIdentifier ; 5) Consumers build ExecuteAppFunctionRequest containing target package name and functionIdentifier via AppFunctionManager ; 6) AppFunctionManager sends the request to Android system; 7) System identifies the service-providing app and binds to its AppFunctionService ; 8) System calls the onExecuteFunction method in the provider app's AppFunctionService ; 9) Provider app executes the requested function and returns ExecuteAppFunctionResponse to the system via OutcomeReceiver ; 10) System passes the response back to the consumer app through the OutcomeReceiver provided when calling executeAppFunction .
Sohu Tech Products
A knowledge-sharing platform for Sohu's technology products. As a leading Chinese internet brand with media, video, search, and gaming services and over 700 million users, Sohu continuously drives tech innovation and practice. We’ll share practical insights and tech news here.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.