語言

AppOpsManager.ModeForeground 欄位

定義

警告

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

特殊模式的意思是「只有在應用程式在前景時才允許」。

[Android.Runtime.Register("MODE_FOREGROUND", ApiSince=29)]
[System.Obsolete("This constant will be removed in the future version. Use Android.App.AppOpsManagerMode enum directly instead of this field.", true)]
public const Android.App.AppOpsManagerMode ModeForeground = 4;
[<Android.Runtime.Register("MODE_FOREGROUND", ApiSince=29)>]
[<System.Obsolete("This constant will be removed in the future version. Use Android.App.AppOpsManagerMode enum directly instead of this field.", true)>]
val mutable ModeForeground : Android.App.AppOpsManagerMode

欄位值

Value = 4
屬性

備註

特殊模式的意思是「只有在應用程式在前景時才允許」。 unsafeCheckOp(String, int, String)、noteOp(String, int, String), startOp(String, int, String) 不會回傳此訊息。 相反地,unsafeCheckOp(String, int, String) 總是會回傳 MODE_ALLOWED(因為最終有可能根據應用程式的背景狀態被允許),而 noteOp(String, int, String) 和 startOp(String, int, String) 會在被檢查的應用程式目前處於前景時回傳 MODE_ALLOWED,否則MODE_IGNORED。 你通常只會在 unsafeCheckOpRaw(String, int, String) 看到這個值,因為它會回傳操作的原始模式。 請注意,因為你無法知道被檢查應用程式的當前狀態(而且狀態隨時可能改變),所以你只能把結果當作它會根據應用程式背景狀態的變化在MODE_ALLOWED和MODE_IGNORED之間變化的指標。 因此,你必須始終使用 noteOp(String, int, String) 或 startOp(String, int, String) 來實際檢查是否能存取該操作。

Android 參考資料。android.app.AppOpsManager.MODE_FOREGROUND

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

適用於