PowerManager.IsIgnoringBatteryOptimizations(String) Method

Definition

Return whether the given application package name is on the device's power allowlist.

[Android.Runtime.Register("isIgnoringBatteryOptimizations", "(Ljava/lang/String;)Z", "GetIsIgnoringBatteryOptimizations_Ljava_lang_String_Handler", ApiSince=23)]
public virtual bool IsIgnoringBatteryOptimizations (string? packageName);
[<Android.Runtime.Register("isIgnoringBatteryOptimizations", "(Ljava/lang/String;)Z", "GetIsIgnoringBatteryOptimizations_Ljava_lang_String_Handler", ApiSince=23)>]
abstract member IsIgnoringBatteryOptimizations : string -> bool
override this.IsIgnoringBatteryOptimizations : string -> bool

Parameters

packageName
String

Returns

Attributes

Remarks

Return whether the given application package name is on the device's power allowlist. Apps can be placed on the allowlist through the settings UI invoked by android.provider.Settings#ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS.

Being on the power allowlist means that the system will not apply most power saving features to the app. Guardrails for extreme cases may still be applied.

Java documentation for android.os.PowerManager.isIgnoringBatteryOptimizations(java.lang.String).

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