Język

ActivityManager.AppTask.MoveTaskTo Method

Definition

Repositions the task to the specified TaskLocation.

[Android.Runtime.Register("moveTaskTo", "(Landroid/app/TaskLocation;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetMoveTaskTo_Landroid_app_TaskLocation_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=37)]
public virtual void MoveTaskTo(Android.App.TaskLocation location, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver callback);
[<Android.Runtime.Register("moveTaskTo", "(Landroid/app/TaskLocation;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetMoveTaskTo_Landroid_app_TaskLocation_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=37)>]
abstract member MoveTaskTo : Android.App.TaskLocation * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
override this.MoveTaskTo : Android.App.TaskLocation * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit

Parameters

location
TaskLocation

TaskLocation with the target display or Display#INVALID_DISPLAY if the target display is the current display, and the new desired bounds

executor
IExecutor

an Executor used to invoke the callback

callback
IOutcomeReceiver

a callback to receive the result of the request

Attributes

Remarks

Repositions the task to the specified TaskLocation.

If the TaskLocation's bounds are invalid (i.e. too small or not fully inside the target display), the request will be rejected.

When the repositioning request is approved or rejected, the callback will be invoked. If the request is approved, the callback will receive a TaskLocation containing the new display ID and bounds of the task. The final display ID and bounds may be adjusted to the closest acceptable states from the requested ones at the system's discretion.

If the request is rejected, the callback will receive an exception with a descriptive message accessible via Exception.getMessage(). This exception will be one of the following: SecurityException if the requester doesn't hold the permission required to use this method;; SecurityException if this task cannot be placed as requested due to violation of the Background Activity Launch (BAL) policy;; IllegalStateException if the task is not in a state that allows it to change its TaskLocation programmatically at runtime of the request;; SecurityException if this task cannot be placed on the target display requested. This can happen when the display is not trusted and not owned by the calling app;; IllegalArgumentException if the TaskLocation provided does not include a valid display ID or the bounds provided are not fully contained inside the given display or the bounds provided are smaller than the minimum size defined in the CDD in either direction.

If the task stays on its original display, its z-order will not be affected. Otherwise, if the task moves to a different display, it will become focused. Requires Manifest.permission.REPOSITION_SELF_WINDOWS

Android reference for android.app.ActivityManager.AppTask.moveTaskTo.

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