Share via


AppFunctionManager Class

Definition

Provides access to App Functions.

[Android.Runtime.Register("android/app/appfunctions/AppFunctionManager", ApiSince=36, DoNotGenerateAcw=true)]
public sealed class AppFunctionManager : Java.Lang.Object
[<Android.Runtime.Register("android/app/appfunctions/AppFunctionManager", ApiSince=36, DoNotGenerateAcw=true)>]
type AppFunctionManager = class
    inherit Object
Inheritance
AppFunctionManager
Attributes

Remarks

Provides access to App Functions. App Functions is currently a beta/experimental preview feature.

An app function is a piece of functionality that apps expose to the system for cross-app orchestration.

<h3>Building App Functions</h3>

Most developers should build app functions through the AppFunctions SDK. This SDK library offers a more convenient and type-safe way to build app functions. The SDK provides predefined function schemas for common use cases and associated data classes for function parameters and return values. Apps only have to implement the provided interfaces. Internally, the SDK converts these data classes into ExecuteAppFunctionRequest#getParameters() and ExecuteAppFunctionResponse#getResultDocument().

<h3>Discovering App Functions</h3>

When there is a package change or the device starts up, the metadata of available functions is indexed on-device by AppSearchManager. AppSearch stores the indexed information as an AppFunctionStaticMetadata document. This document contains the functionIdentifier and the schema information that the app function implements. This allows other apps and the app itself to discover these functions using the AppSearch search APIs. Visibility to this metadata document is based on the packages that have visibility to the app providing the app functions. AppFunction SDK provides a convenient way to achieve this and is the preferred method.

<h3>Executing App Functions</h3>

To execute an app function, the caller app can retrieve the functionIdentifier from the AppFunctionStaticMetadata document and use it to build an ExecuteAppFunctionRequest. Then, invoke #executeAppFunction with the request to execute the app function. Callers need the android.permission.EXECUTE_APP_FUNCTIONS permission to execute app functions from other apps. An app can always execute its own app functions and doesn't need these permissions. AppFunction SDK provides a convenient way to achieve this and is the preferred method.

<h3>Example</h3>

An assistant app is trying to fulfill the user request "Save XYZ into my note". The assistant app should first list all available app functions as AppFunctionStaticMetadata documents from AppSearch. Then, it should identify an app function that implements the CreateNote schema. Finally, the assistant app can invoke #executeAppFunction with the functionIdentifier of the chosen function.

Java documentation for android.app.appfunctions.AppFunctionManager.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

AppFunctionStateDefault
Obsolete.

The default state of the app function.

AppFunctionStateDisabled
Obsolete.

The app function is disabled.

AppFunctionStateEnabled
Obsolete.

The app function is enabled.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
ExecuteAppFunction(ExecuteAppFunctionRequest, IExecutor, CancellationSignal, IOutcomeReceiver)

Executes the app function.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IsAppFunctionEnabled(String, IExecutor, IOutcomeReceiver)

Returns a boolean through a callback, indicating whether the app function is enabled.

IsAppFunctionEnabled(String, String, IExecutor, IOutcomeReceiver)

Returns a boolean through a callback, indicating whether the app function is enabled.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetAppFunctionEnabled(String, AppFunctionState, IExecutor, IOutcomeReceiver)

Sets the enabled state of the app function owned by the calling package.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to