ExecuteAppFunctionRequest.Builder


public static final class ExecuteAppFunctionRequest.Builder
extends Object

java.lang.Object
   ↳ android.app.appfunctions.ExecuteAppFunctionRequest.Builder


Builder for ExecuteAppFunctionRequest.

Summary

Public constructors

Builder(AppFunctionName appFunctionName)

Constructs a ExecuteAppFunctionRequest.Builder.

Builder(String targetPackageName, String functionIdentifier)

Constructs a ExecuteAppFunctionRequest.Builder.

Public methods

ExecuteAppFunctionRequest build()

Builds the ExecuteAppFunctionRequest.

ExecuteAppFunctionRequest.Builder setActivityId(AppFunctionActivityId activityId)

Sets the AppFunctionActivityId.

ExecuteAppFunctionRequest.Builder setAttribution(AppInteractionAttribution attribution)

Sets the AppInteractionAttribution.

ExecuteAppFunctionRequest.Builder setExtras(Bundle extras)

Sets the additional metadata for this function execution request.

ExecuteAppFunctionRequest.Builder setParameters(GenericDocument parameters)

Sets the function parameters as a key-value GenericDocument.

Inherited methods

Public constructors

Builder

Added in API level 37
public Builder (AppFunctionName appFunctionName)

Constructs a ExecuteAppFunctionRequest.Builder.

Parameters
appFunctionName AppFunctionName: The AppFunctionName of the target app function. See AppFunctionMetadata.getName for how to determine this value.
This value cannot be null.

Builder

Added in API level 36
public Builder (String targetPackageName, 
                String functionIdentifier)

Constructs a ExecuteAppFunctionRequest.Builder.

Parameters
targetPackageName String: The package name of the app that hosts the app function. See AppFunctionMetadata.getName for how to determine this value.
This value cannot be null.

functionIdentifier String: The unique identifier for the app function to be executed. See AppFunctionMetadata.getName for how to determine this value.
This value cannot be null.

Public methods

build

Added in API level 36
public ExecuteAppFunctionRequest build ()

Builds the ExecuteAppFunctionRequest.

Returns
ExecuteAppFunctionRequest This value cannot be null.

setActivityId

Added in API level 37
public ExecuteAppFunctionRequest.Builder setActivityId (AppFunctionActivityId activityId)

Sets the AppFunctionActivityId.

If the target app function's AppFunctionMetadata.getScope is AppFunctionMetadata.SCOPE_ACTIVITY, this must be set to disambiguate between instances of the same app function running in different activities.

The value must be unset or null if the target app function is not AppFunctionMetadata.SCOPE_ACTIVITY.

The list of valid activity identifiers for a given function name can be obtained by calling AppFunctionManager.getAppFunctionStates. The returned AppFunctionState objects will contain the associated activity IDs via AppFunctionState.getActivityIds().

The list of functions provided by an activity can be obtained by calling AppFunctionManager.getAppFunctionActivityStates.

Parameters
activityId AppFunctionActivityId: The activity identifier to associate with this request.
This value may be null.

Returns
ExecuteAppFunctionRequest.Builder

setAttribution

Added in API level 37
public ExecuteAppFunctionRequest.Builder setAttribution (AppInteractionAttribution attribution)

Sets the AppInteractionAttribution.

This information can be used by the privacy setting to provide transparency to the user about why an app function was invoked.

This is currently optional, but may become required for apps targeting a future release.

Parameters
attribution AppInteractionAttribution: The attribution for this request.
This value cannot be null.

Returns
ExecuteAppFunctionRequest.Builder This value cannot be null.

setExtras

Added in API level 36
public ExecuteAppFunctionRequest.Builder setExtras (Bundle extras)

Sets the additional metadata for this function execution request.

Parameters
extras Bundle: The additional metadata for this function execution request.
This value cannot be null.

Returns
ExecuteAppFunctionRequest.Builder This value cannot be null.

setParameters

Added in API level 36
public ExecuteAppFunctionRequest.Builder setParameters (GenericDocument parameters)

Sets the function parameters as a key-value GenericDocument.

Parameters
parameters GenericDocument: The parameters for this function execution request.
This value cannot be null.

Returns
ExecuteAppFunctionRequest.Builder This value cannot be null.