Megosztás a következőn keresztül:


Settings.ActionRequestIgnoreBatteryOptimizations Field

Definition

Activity Action: Ask the user to allow an app to ignore battery optimizations (that is, put them on the whitelist of apps shown by #ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS).

[Android.Runtime.Register("ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS", ApiSince=23)]
public const string ActionRequestIgnoreBatteryOptimizations;
[<Android.Runtime.Register("ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS", ApiSince=23)>]
val mutable ActionRequestIgnoreBatteryOptimizations : string

Field Value

Attributes

Remarks

Activity Action: Ask the user to allow an app to ignore battery optimizations (that is, put them on the whitelist of apps shown by #ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS). For an app to use this, it also must hold the android.Manifest.permission#REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission.

<b>Note:</b> most applications should <em>not</em> use this; there are many facilities provided by the platform for applications to operate correctly in the various power saving modes. This is only for unusual applications that need to deeply control their own execution, at the potential expense of the user's battery life. Note that these applications greatly run the risk of showing to the user as high power consumers on their device.

Input: The Intent's data URI must specify the application package name to be shown, with the "package" scheme. That is "package:com.my.app".

Output: Nothing.

You can use android.os.PowerManager#isIgnoringBatteryOptimizations PowerManager.isIgnoringBatteryOptimizations() to determine if an application is already ignoring optimizations.

Java documentation for android.provider.Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS.

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