ExecuteAppFunctionRequest.Builder


public static final class ExecuteAppFunctionRequest.Builder
extends Object

java.lang.Object
   ↳ android.app.appsearch.functions.ExecuteAppFunctionRequest.Builder


The builder for creating ExecuteAppFunctionRequest instances.

Summary

Public constructors

Builder(String packageName, String functionIdentifier)

Creates a new instance of this builder class.

Public methods

ExecuteAppFunctionRequest build()

Constructs a new ExecuteAppFunctionRequest from the contents of this builder.

ExecuteAppFunctionRequest.Builder setExtras(Bundle extras)

Sets the additional metadata relevant to this function execution request.

ExecuteAppFunctionRequest.Builder setParameters(GenericDocument parameters)

Sets parameters for invoking the app function.

ExecuteAppFunctionRequest.Builder setSha256Certificate(byte[] sha256Certificate)

Sets the expected certificate SHA-256 digests for the target package.

Inherited methods

Public constructors

Builder

public Builder (String packageName, 
                String functionIdentifier)

Creates a new instance of this builder class.

Parameters
packageName String: The package name of the target app providing the app function to invoke. This value cannot be null.

functionIdentifier String: The identifier used by the AppFunctionService from the target app to uniquely identify the function to be invoked. This value cannot be null.

Public methods

build

public ExecuteAppFunctionRequest build ()

Constructs a new ExecuteAppFunctionRequest from the contents of this builder.

Returns
ExecuteAppFunctionRequest This value cannot be null.

setExtras

public ExecuteAppFunctionRequest.Builder setExtras (Bundle extras)

Sets the additional metadata relevant to this function execution request. Defaults to an empty Bundle if not set.

Parameters
extras Bundle: This value cannot be null.

Returns
ExecuteAppFunctionRequest.Builder This value cannot be null.

setParameters

public ExecuteAppFunctionRequest.Builder setParameters (GenericDocument parameters)

Sets parameters for invoking the app function. Within this GenericDocument, the property names are the names of the function parameters and the property values are the values of those parameters. Defaults to an empty GenericDocument if not set.

Parameters
parameters GenericDocument: This value cannot be null.

Returns
ExecuteAppFunctionRequest.Builder This value cannot be null.

setSha256Certificate

public ExecuteAppFunctionRequest.Builder setSha256Certificate (byte[] sha256Certificate)

Sets the expected certificate SHA-256 digests for the target package. Setting this to null indicates that no certificate digest check will be performed.

SHA-256 certificate digests for a signed application can be retrieved with the apksigner tool that is part of the Android SDK build tools. Use apksigner verify --print-certs path/to/apk.apk to retrieve the SHA-256 certificate digest for the target application. Once retrieved, the SHA-256 certificate digest should be converted to a byte[] by decoding it in base16:

 new android.content.pm.Signature(outputDigest).toByteArray();
 

Parameters
sha256Certificate byte: This value may be null.

Returns
ExecuteAppFunctionRequest.Builder