語言

AppFunctionMetadata.ScopeGlobal 欄位

定義

警告

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

一個表示應用程式函式具有全域範圍的常數。

[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

欄位值

Value = 0

實作

屬性

備註

一個表示應用程式函式具有全域範圍的常數。

此範圍最多只能有一個應用程式函式實作,且名稱相同。 這對於綁定到單一元件的函式(如前景服務)非常有用。

使用 AppFunctionManager.registerAppFunction 時,函式會保持註冊狀態,直到被明確取消註冊或呼叫上下文被摧毀。

要執行全域範圍函式,呼叫 AppFunctionManager.executeAppFunction 的使用者不得使用 ExecuteAppFunctionRequest.Builder.setActivityId(或將其設為 null),否則AppFunctionException.ERROR_FUNCTION_NOT_FOUND會被回傳。

這始終是基於 AppFunctionService 函式的範疇。

重要提示:從活動上下文呼叫的 AppFunctionManager.registerAppFunction 函式應優先使用SCOPE_ACTIVITY。 只有當你絕對確定該活動只能有單一實例時,才會用SCOPE_GLOBAL來做這類功能。

Android 參考資料。android.app.appfunctions.AppFunctionMetadata.SCOPE_GLOBAL

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於