Language

Activity.OnHandoffActivityDataRequested Method

Definition

Retrieves HandoffActivityData representing this activity, allowing it to be recreated on another device owned by the user.

[Android.Runtime.Register("onHandoffActivityDataRequested", "(Landroid/app/HandoffActivityDataRequestInfo;)Landroid/app/HandoffActivityData;", "GetOnHandoffActivityDataRequested_Landroid_app_HandoffActivityDataRequestInfo_Handler", ApiSince=37)]
public virtual Android.App.HandoffActivityData? OnHandoffActivityDataRequested(Android.App.HandoffActivityDataRequestInfo requestInfo);
[<Android.Runtime.Register("onHandoffActivityDataRequested", "(Landroid/app/HandoffActivityDataRequestInfo;)Landroid/app/HandoffActivityData;", "GetOnHandoffActivityDataRequested_Landroid_app_HandoffActivityDataRequestInfo_Handler", ApiSince=37)>]
abstract member OnHandoffActivityDataRequested : Android.App.HandoffActivityDataRequestInfo -> Android.App.HandoffActivityData
override this.OnHandoffActivityDataRequested : Android.App.HandoffActivityDataRequestInfo -> Android.App.HandoffActivityData

Parameters

requestInfo
HandoffActivityDataRequestInfo

the request info for the activity data.

Returns

the activity data for handoff.

Attributes

Remarks

Retrieves HandoffActivityData representing this activity, allowing it to be recreated on another device owned by the user. The system automatically handles calling onHandoffActivityDataRequested. This will only be called if isHandoffEnabled() is true for this activity. If isHandoffEnabled() is true, the activity is expected to return a non-null value. Returning null will present an error to the user indicating Handoff unexpectedly failed. If the current activity is in the foreground on the current device, the app's icon representing this activity will be shown on other nearby devices owned by the user. If the user selects this icon, the system will call this method to retrieve the data needed to recreate this activity on another device. When this activity is stopped, the system will call this method to retrieve HandoffActivityData for caching. This allows the user to hand this activity off to another device even if it is not currently running. In these situations, HandoffActivityDataRequestInfo.isActiveRequest will be false.

Android reference for android.app.Activity.onHandoffActivityDataRequested.

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