ExecuteAppFunctionResponse
class ExecuteAppFunctionResponse : Parcelable
kotlin.Any | |
↳ | android.app.appfunctions.ExecuteAppFunctionResponse |
The response to an app function execution.
Summary
Constants | |
---|---|
static String |
The name of the property that stores the function return value within the |
static Int |
An unknown error occurred while processing the call in the AppFunctionService. |
static Int |
The operation was cancelled. |
static Int |
The caller does not have the permission to execute an app function. |
static Int |
The caller tried to execute a disabled app function. |
static Int |
An internal error occurred within AppFunctionManagerService. |
static Int |
The caller supplied invalid arguments to the call. |
static Int |
The call was successful. |
Inherited constants | |
---|---|
Public methods | |
---|---|
Int | |
String? |
Returns the error message associated with this result. |
Bundle |
Returns the extras of the app function execution. |
Int |
Returns one of the |
GenericDocument |
Returns a generic document containing the return value of the executed function. |
Boolean |
Returns |
static ExecuteAppFunctionResponse |
newFailure(resultCode: Int, errorMessage: String?, extras: Bundle?) Returns a failure response. |
static ExecuteAppFunctionResponse |
newSuccess(resultDocument: GenericDocument, extras: Bundle?) Returns a successful response. |
Unit |
writeToParcel(dest: Parcel, flags: Int) Flatten this object in to a Parcel. |
Properties | |
---|---|
static Parcelable.Creator<ExecuteAppFunctionResponse!> |
Constants
PROPERTY_RETURN_VALUE
static val PROPERTY_RETURN_VALUE: String
The name of the property that stores the function return value within the resultDocument
.
See GenericDocument.getProperty(String)
for more information.
If the function returns void
or throws an error, the resultDocument
will be empty GenericDocument
.
If the resultDocument
is empty, GenericDocument.getProperty(String)
will return null
.
See getResultDocument
for more information on extracting the return value.
Value: "returnValue"
RESULT_APP_UNKNOWN_ERROR
static val RESULT_APP_UNKNOWN_ERROR: Int
An unknown error occurred while processing the call in the AppFunctionService.
Value: 2
RESULT_CANCELLED
static val RESULT_CANCELLED: Int
The operation was cancelled. Use this error code to report that a cancellation is done after receiving a cancellation signal.
Value: 6
RESULT_DENIED
static val RESULT_DENIED: Int
The caller does not have the permission to execute an app function.
Value: 1
RESULT_DISABLED
static val RESULT_DISABLED: Int
The caller tried to execute a disabled app function.
Value: 5
RESULT_INTERNAL_ERROR
static val RESULT_INTERNAL_ERROR: Int
An internal error occurred within AppFunctionManagerService.
This error may be considered similar to IllegalStateException
Value: 3
RESULT_INVALID_ARGUMENT
static val RESULT_INVALID_ARGUMENT: Int
The caller supplied invalid arguments to the call.
This error may be considered similar to IllegalArgumentException
.
Value: 4
Public methods
describeContents
fun describeContents(): Int
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getErrorMessage
fun getErrorMessage(): String?
Returns the error message associated with this result.
If isSuccess
is true
, the error message is always null
.
getExtras
fun getExtras(): Bundle
Returns the extras of the app function execution.
Return | |
---|---|
Bundle |
This value cannot be null . |
getResultCode
fun getResultCode(): Int
Returns one of the RESULT
constants defined in ExecuteAppFunctionResponse
.
getResultDocument
fun getResultDocument(): GenericDocument
Returns a generic document containing the return value of the executed function.
The PROPERTY_RETURN_VALUE
key can be used to obtain the return value.
An empty document is returned if isSuccess
is false
or if the executed function does not produce a return value.
Sample code for 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 <code><a docref="android.app.appsearch.GenericDocument$getPropertyString(kotlin.String)">GenericDocument.getPropertyString</a></code>, // <code><a docref="android.app.appsearch.GenericDocument$getPropertyLong(kotlin.String)">GenericDocument.getPropertyLong</a></code>etc. // Do something with the returnValue }
isSuccess
fun isSuccess(): Boolean
Returns true
if getResultCode
equals android.app.appfunctions.ExecuteAppFunctionResponse#RESULT_OK
.
newFailure
static fun newFailure(
resultCode: Int,
errorMessage: String?,
extras: Bundle?
): ExecuteAppFunctionResponse
Returns a failure response.
Parameters | |
---|---|
resultCode |
Int: The result code of the app function execution. Value is android.app.appfunctions.ExecuteAppFunctionResponse#RESULT_OK , android.app.appfunctions.ExecuteAppFunctionResponse#RESULT_DENIED , android.app.appfunctions.ExecuteAppFunctionResponse#RESULT_APP_UNKNOWN_ERROR , android.app.appfunctions.ExecuteAppFunctionResponse#RESULT_INTERNAL_ERROR , android.app.appfunctions.ExecuteAppFunctionResponse#RESULT_INVALID_ARGUMENT , android.app.appfunctions.ExecuteAppFunctionResponse#RESULT_DISABLED , or android.app.appfunctions.ExecuteAppFunctionResponse#RESULT_CANCELLED |
extras |
Bundle?: The additional metadata data relevant to this function execution response. This value may be null . |
errorMessage |
String?: The error message associated with the result, if any. This value may be null . |
Return | |
---|---|
ExecuteAppFunctionResponse |
This value cannot be null . |
newSuccess
static fun newSuccess(
resultDocument: GenericDocument,
extras: Bundle?
): ExecuteAppFunctionResponse
Returns a successful response.
Parameters | |
---|---|
resultDocument |
GenericDocument: The return value of the executed function. This value cannot be null . |
extras |
Bundle?: The additional metadata data relevant to this function execution response. This value may be null . |
Return | |
---|---|
ExecuteAppFunctionResponse |
This value cannot be null . |
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
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_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
Properties
CREATOR
static val CREATOR: Parcelable.Creator<ExecuteAppFunctionResponse!>