AppOpsManager.ModeForeground Field
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
This constant will be removed in the future version. Use Android.App.AppOpsManagerMode enum directly instead of this field.
Special mode that means "allow only when app is in foreground.
[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
Field Value
Value = 4- Attributes
Remarks
Special mode that means "allow only when app is in foreground." This is <b>not</b> returned from #unsafeCheckOp
, #noteOp
, #startOp
. Rather, #unsafeCheckOp
will always return #MODE_ALLOWED
(because it is always possible for it to be ultimately allowed, depending on the app's background state), and #noteOp
and #startOp
will return #MODE_ALLOWED
when the app being checked is currently in the foreground, otherwise #MODE_IGNORED
.
The only place you will this normally see this value is through #unsafeCheckOpRaw
, which returns the actual raw mode of the op. Note that because you can't know the current state of the app being checked (and it can change at any point), you can only treat the result here as an indication that it will vary between #MODE_ALLOWED
and #MODE_IGNORED
depending on changes in the background state of the app. You thus must always use #noteOp
or #startOp
to do the actual check for access to the op.
Java documentation for android.app.AppOpsManager.MODE_FOREGROUND
.
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.