Udostępnij za pośrednictwem


ActivityManager.KillBackgroundProcesses(String) Method

Definition

Have the system immediately kill all background processes associated with the given package.

[Android.Runtime.Register("killBackgroundProcesses", "(Ljava/lang/String;)V", "GetKillBackgroundProcesses_Ljava_lang_String_Handler")]
[Android.Runtime.RequiresPermission("android.permission.KILL_BACKGROUND_PROCESSES")]
public virtual void KillBackgroundProcesses (string? packageName);
[<Android.Runtime.Register("killBackgroundProcesses", "(Ljava/lang/String;)V", "GetKillBackgroundProcesses_Ljava_lang_String_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.KILL_BACKGROUND_PROCESSES")>]
abstract member KillBackgroundProcesses : string -> unit
override this.KillBackgroundProcesses : string -> unit

Parameters

packageName
String

The name of the package whose processes are to be killed.

Attributes

Remarks

Have the system immediately kill all background processes associated with the given package. This is the same as the kernel killing those processes to reclaim memory; the system will take care of restarting these processes in the future as needed.

<p class="note">On devices that run Android 14 or higher, third party applications can only use this API to kill their own processes. </p>

Java documentation for android.app.ActivityManager.killBackgroundProcesses(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