Langue

AppFunctionMetadata.ScopeActivity Field

Definition

Caution

This constant will be removed in the future version. Use Android.App.AppFunctions.AppFunctionMetadataScope enum directly instead of this field.

A constant indicating an app function is activity-scoped.

[Android.Runtime.Register("SCOPE_ACTIVITY", ApiSince=37)]
[System.Obsolete("This constant will be removed in the future version. Use Android.App.AppFunctions.AppFunctionMetadataScope enum directly instead of this field.", true)]
public const Android.App.AppFunctions.AppFunctionMetadataScope ScopeActivity = 1;
[<Android.Runtime.Register("SCOPE_ACTIVITY", ApiSince=37)>]
[<System.Obsolete("This constant will be removed in the future version. Use Android.App.AppFunctions.AppFunctionMetadataScope enum directly instead of this field.", true)>]
val mutable ScopeActivity : Android.App.AppFunctions.AppFunctionMetadataScope

Field Value

Value = 1

Implements

Attributes

Remarks

A constant indicating an app function is activity-scoped.

Multiple app function implementations with the same AppFunctionName can exist simultaneously, each registered from a different Activity instance, which is identified by an AppFunctionActivityId.

Functions with this scope must be registered using AppFunctionManager.registerAppFunction, and must be called from an Activity context. Calling it from any other context will result in an IllegalStateException.

To execute an activity-scoped function, the caller of AppFunctionManager.executeAppFunction must use ExecuteAppFunctionRequest.Builder.setActivityId, otherwise AppFunctionException.ERROR_FUNCTION_NOT_FOUND will be returned.

To discover the specific activities where an activity-scoped function is currently registered, see AppFunctionManager.getAppFunctionStates and AppFunctionManager.getAppFunctionActivityStates.

The function remains registered until it is explicitly unregistered or the activity is destroyed.

IMPORTANT: Functions provided with AppFunctionManager.registerAppFunction called from an Activity context should prefer SCOPE_ACTIVITY. Only use SCOPE_GLOBAL for such functions if you are absolutely sure there can be only one instance of that activity.

Android reference for android.app.appfunctions.AppFunctionMetadata.SCOPE_ACTIVITY.

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.

Applies to