[ Web Proxy ]
URL:
Viewing: https://developer.android.com/reference/androidx/appfunctions/AppFunctionServiceEntryPoint [Back]  [Original]

AppFunctionServiceEntryPoint  |  API reference  |  Android Developers Skip to main content
Essentials Design & Plan Develop Google Play Blog
Search:
Android Studio
Android Developers [Android Developers]
Stay organized with collections Save and categorize content based on your preferences.

AppFunctionServiceEntryPoint


@Retention(value = AnnotationRetention.SOURCE)
@Target(allowedTargets = [AnnotationTarget.CLASS])
public annotation AppFunctionServiceEntryPoint


Annotation to mark AppFunctionService as an entry point.

This annotation helps generate a service, bridging AppFunctionService.onExecuteFunction and AppFunction-annotated methods defined in the same class.

Example

First, define your service:

import androidx.appfunctions.AppFunctionServiceEntryPoint
import
androidx.appfunctions.AppFunction
import
androidx.appfunctions.AppFunctionService

@AppFunctionServiceEntryPoint(
serviceName = "MyAppFunctionService",
appFunctionXmlFileName = "my_service"
)
abstract class BaseMyAppFunctionService : AppFunctionService() {
@AppFunction fun add(a: Int, b: Int): Int = a + b
}

Then, declare the generated service and XML file in your AndroidManifest.xml:

<service
android:name=".MyAppFunctionService"
android:permission="android.permission.BIND_APP_FUNCTION_SERVICE"
android:exported="true">
<property
android:name="android.app.appfunctions.schema"
android:value="app_functions_schema.xsd" />
<property
android:name="android.app.appfunctions.v2"
android:value="my_service.xml" />
<intent-filter>
<action android:name="android.app.appfunctions.AppFunctionService" />
</intent-filter>
</service>

Generated content

The AppFunction compiler processes classes marked with this annotation to generate two key artifacts:

public class MyAppFunctionService : BaseMyAppFunctionService() {
override suspend fun onExecuteFunction(
request: ExecuteAppFunctionRequest
): ExecuteAppFunctionResponse {
return when (request.functionIdentifier) {
FUNCTION_ID_ADD -> {
add(request.parameters.getInt("a"), request.getParameters.getInt("b"))
}
...
}.toAppFunctionResponse()
}

public companion object {
public const val FUNCTION_ID_ADD: String = <id>
}
}
<appfunctions>
<appfunction>
<id>add</id>
<enabledByDefault>true</enabledByDefault>
<parameters>...</parameters>
<response>...</response>
</appfunction>
</appfunctions>
See also
AppFunctionService
AppFunction

Summary

Public constructors

AppFunctionServiceEntryPoint(
    @NonNull String serviceName,
    @NonNull String appFunctionXmlFileName
)

Public methods

final @NonNull String

The name of the generated app function XML file.

final @NonNull String

The name of the generated service class.

Public constructors

AppFunctionServiceEntryPoint

Added in 1.0.0-alpha10
public AppFunctionServiceEntryPoint(
    @NonNull String serviceName,
    @NonNull String appFunctionXmlFileName
)
Parameters
@NonNull String serviceName

The name of the generated service class.

@NonNull String appFunctionXmlFileName

The name of the generated app function XML file.

Public methods

getAppFunctionXmlFileName

public final @NonNull String getAppFunctionXmlFileName()

The name of the generated app function XML file.

getServiceName

public final @NonNull String getServiceName()

The name of the generated service class.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-07-01 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-07-01 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page