Język

AppFunctionMetadata.ScopeGlobal Field

Definition

Caution

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

A value returned from #getScope that indicates it is a globally-scoped app function.

[Android.Runtime.Register("SCOPE_GLOBAL", 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 ScopeGlobal = 0;
[<Android.Runtime.Register("SCOPE_GLOBAL", 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 ScopeGlobal : Android.App.AppFunctions.AppFunctionMetadataScope

Field Value

Value = 0

Implements

Attributes

Remarks

A constant indicating an app function is globally-scoped.

There can be at most one app function implementation with the same AppFunctionName available with this scope. This is useful for functions that are tied to a singleton component, such as a foreground service.

When using AppFunctionManager.registerAppFunction, the function remains registered until it is explicitly unregistered or the calling context is destroyed.

To execute a globally-scoped function, the caller of AppFunctionManager.executeAppFunction must not use ExecuteAppFunctionRequest.Builder.setActivityId (or set it to null), otherwise AppFunctionException.ERROR_FUNCTION_NOT_FOUND will be returned.

This is always the scope for AppFunctionService-based functions.

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_GLOBAL.

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