Udostępnij za pośrednictwem


ActivityManager.IsBackgroundRestricted Property

Definition

Query whether the user has enabled background restrictions for this app.

public virtual bool IsBackgroundRestricted { [Android.Runtime.Register("isBackgroundRestricted", "()Z", "GetIsBackgroundRestrictedHandler", ApiSince=28)] get; }
[<get: Android.Runtime.Register("isBackgroundRestricted", "()Z", "GetIsBackgroundRestrictedHandler", ApiSince=28)>]
member this.IsBackgroundRestricted : bool

Property Value

true if user has enforced background restrictions for this app, false otherwise.

Attributes

Remarks

Query whether the user has enabled background restrictions for this app.

The user may chose to do this, if they see that an app is consuming an unreasonable amount of battery while in the background.

If true, any work that the app tries to do will be aggressively restricted while it is in the background. At a minimum, jobs and alarms will not execute and foreground services cannot be started unless an app activity is in the foreground.

<b> Note that these restrictions stay in effect even when the device is charging.</b>

Java documentation for android.app.ActivityManager.isBackgroundRestricted().

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