AppFunctionMetadata.ScopeActivity 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
This constant will be removed in the future version. Use Android.App.AppFunctions.AppFunctionMetadataScope enum directly instead of this field.
一個表示應用程式函式的常數是活動範圍的。
[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
欄位值
Value = 1實作
- 屬性
備註
一個表示應用程式函式的常數是活動範圍的。
多個具有相同 AppFunctionName 的應用程式函式實作可以同時存在,每個實例都從不同的活動實例註冊,該實例以 AppFunctionActivityID 來識別。
具有此範圍的函式必須使用 AppFunctionManager.registerAppFunction 註冊,並且必須從活動上下文中呼叫。 從其他情境呼叫時,會觸發 IllegalStateException。
若要執行具有活動範圍的函式,呼叫 AppFunctionManager.executeAppFunction 的使用者必須使用 ExecuteAppFunctionRequest.Builder.setActivityId,否則AppFunctionException.ERROR_FUNCTION_NOT_FOUND會被回傳。
欲了解活動範圍函式目前註冊的特定活動,請參閱 AppFunctionManager.getAppFunctionStates 與 AppFunctionManager.getAppFunctionActivityStates。
函式會保持註冊狀態,直到被明確取消註冊或活動被銷毀為止。
重要提示:從活動上下文呼叫的 AppFunctionManager.registerAppFunction 函式應優先使用SCOPE_ACTIVITY。 只有當你絕對確定該活動只能有單一實例時,才會用SCOPE_GLOBAL來做這類功能。
Android 參考資料。android.app.appfunctions.AppFunctionMetadata.SCOPE_ACTIVITY
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。