Jaa


UserActivityChannel Class

Definition

Creates or gets UserActivity objects created on this or another device.

public ref class UserActivityChannel sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class UserActivityChannel final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class UserActivityChannel final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class UserActivityChannel
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class UserActivityChannel
Public NotInheritable Class UserActivityChannel
Inheritance
Object Platform::Object IInspectable UserActivityChannel
Attributes

Windows requirements

Device family
Windows 10 Fall Creators Update (introduced in 10.0.16299.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v5.0)

Examples

   // Get the default UserActivityChannel and query it for our UserActivity. If the activity doesn't exist, one is created.
   UserActivityChannel channel = UserActivityChannel.GetDefault();
   UserActivity userActivity = await channel.GetOrCreateUserActivityAsync("AddCustomerPage");

Remarks

Version history

Windows version SDK version Value added
1803 17134 DisableAutoSessionCreation
1803 17134 GetRecentUserActivitiesAsync
1803 17134 GetSessionHistoryItemsForUserActivityAsync
1803 17134 TryGetForWebAccount
1903 18362 GetForUser

Methods

DeleteActivityAsync(String)

Delete a specific user activity.

DeleteAllActivitiesAsync()

Deletes all of the user activities registered by this app.

DisableAutoSessionCreation()

Disable the automatic creation of a session when a new UserActivity is created.

GetDefault()

Provides access to the User Activities associated with the user's Managed Service Account (MSA).

GetForUser(User)

Gets a UserActivityChannel object that can be used to get or create UserActivity objects for the specified user in the context of the current app.

GetOrCreateUserActivityAsync(String)

Create (or get) a UserActivity with the specified id.

GetRecentUserActivitiesAsync(Int32)

Get up to the specified number of the most recently engaged user activities, sorted by the time each user activity ended.

GetSessionHistoryItemsForUserActivityAsync(String, DateTime)

Gets the session history for a user activity.

TryGetForWebAccount(WebAccount)

Get a channel, specific to a specified web account, to use to record user activity.

Applies to