Share via


UserActivity.ToJson Method

Definition

Serializes the UserActivity into a JSON string. Among other things, the JSON string will contain the App display name, the activation URL, the content URL, content information, and visual element information such as description, background color, and so on.

public:
 virtual Platform::String ^ ToJson() = ToJson;
winrt::hstring ToJson();
public string ToJson();
function toJson()
Public Function ToJson () As String

Returns

String

Platform::String

winrt::hstring

The JSON text representation of the UserActivity.

Windows requirements

Device family
Windows 10, version 1803 (introduced in 10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v6.0)

Remarks

A better re-engagement UI can be built within a consuming application if the source application can provide more details about the re-engagement. By serializing the UserActivity into a JSON string, you can then store it in a DataPackage and reconstitute it in the consuming application to provide more insight about the source application and the specific activity within the application that sourced the DataPackage.

Applies to

See also