ExecuteAppFunctionResponse


public final class ExecuteAppFunctionResponse
extends Object implements Parcelable

java.lang.Object
   ↳ android.app.appfunctions.ExecuteAppFunctionResponse


The response to an app function execution, returned by AppFunctionManager.executeAppFunction.

Use AppFunctionMetadata to determine the expected structure of the response.

Summary

Constants

String PROPERTY_RETURN_VALUE

The name of the property that stores the function return value within the getResultDocument().

Inherited constants

Fields

public static final Creator<ExecuteAppFunctionResponse> CREATOR

Public constructors

ExecuteAppFunctionResponse(GenericDocument resultDocument)

Constructs an ExecuteAppFunctionResponse.

ExecuteAppFunctionResponse(GenericDocument resultDocument, Bundle extras)

Constructs an ExecuteAppFunctionResponse with an additional Bundle.

ExecuteAppFunctionResponse(GenericDocument resultDocument, Bundle extras, List<AppFunctionUriGrant> uriGrants)

Constructs an ExecuteAppFunctionResponse with an additional Bundle and AppFunctionUriGrants.

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Bundle getExtras()

Returns the additional metadata for this function execution response.

GenericDocument getResultDocument()

Returns a GenericDocument containing the return value of the executed function.

List<AppFunctionUriGrant> getUriGrants()

The list of AppFunctionUriGrant to which the caller of this app function execution should have temporary access granted.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

PROPERTY_RETURN_VALUE

Added in API level 36
public static final String PROPERTY_RETURN_VALUE

The name of the property that stores the function return value within the getResultDocument().

If the function returns void or throws an error, this property will not be set.

Constant Value: "androidAppfunctionsReturnValue"

Fields

CREATOR

Added in API level 36
public static final Creator<ExecuteAppFunctionResponse> CREATOR

Public constructors

ExecuteAppFunctionResponse

Added in API level 36
public ExecuteAppFunctionResponse (GenericDocument resultDocument)

Constructs an ExecuteAppFunctionResponse.

Parameters
resultDocument GenericDocument: The return value of the executed function, see getResultDocument().
This value cannot be null.

ExecuteAppFunctionResponse

Added in API level 36
public ExecuteAppFunctionResponse (GenericDocument resultDocument, 
                Bundle extras)

Constructs an ExecuteAppFunctionResponse with an additional Bundle.

Parameters
resultDocument GenericDocument: The return value of the executed function, see getResultDocument().
This value cannot be null.

extras Bundle: The additional metadata for this function execution response, see getExtras().
This value cannot be null.

ExecuteAppFunctionResponse

Added in API level 37
public ExecuteAppFunctionResponse (GenericDocument resultDocument, 
                Bundle extras, 
                List<AppFunctionUriGrant> uriGrants)

Constructs an ExecuteAppFunctionResponse with an additional Bundle and AppFunctionUriGrants.

Parameters
resultDocument GenericDocument: The return value of the executed function, see getResultDocument().
This value cannot be null.

extras Bundle: The additional metadata for this function execution response, see getExtras().
This value cannot be null.

uriGrants List: The list of AppFunctionUriGrant to which the caller of this app function execution should have temporary access granted.
This value cannot be null.

Public methods

describeContents

Added in API level 36
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getExtras

Added in API level 36
public Bundle getExtras ()

Returns the additional metadata for this function execution response.

Returns
Bundle This value cannot be null.

getResultDocument

Added in API level 36
public GenericDocument getResultDocument ()

Returns a GenericDocument containing the return value of the executed function.

The PROPERTY_RETURN_VALUE key can be used to obtain the return value.

Example of extracting the return value:

GenericDocument resultDocument = response.getResultDocument();
 Object returnValue = resultDocument.getProperty(PROPERTY_RETURN_VALUE);
 if (returnValue != null) {
   // Cast returnValue to expected type, or use GenericDocument#getPropertyString,
   // GenericDocument#getPropertyLong, etc.
 }
 

Use AppFunctionMetadata to determine the expected structure of this document.

Returns
GenericDocument

getUriGrants

Added in API level 37
public List<AppFunctionUriGrant> getUriGrants ()

The list of AppFunctionUriGrant to which the caller of this app function execution should have temporary access granted.

Returns
List<AppFunctionUriGrant> This value cannot be null.

writeToParcel

Added in API level 36
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following: