LaunchActivatedEventArgs LaunchActivatedEventArgs LaunchActivatedEventArgs LaunchActivatedEventArgs Class

Definition

Provides event information when an app is launched.

JavaScript This type appears as WebUILaunchActivatedEventArgs.

public sealed class LaunchActivatedEventArgspublic sealed class LaunchActivatedEventArgsPublic NotInheritable Class LaunchActivatedEventArgspublic sealed class LaunchActivatedEventArgs
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This object is accessed when you respond to Activated events when ActivationKind is Launch.

Windows Store app using C++, C#, or Visual Basic typically implement activation points by overriding methods of the Application object. The default template app.xaml code-behind files always include an override for OnLaunched(LaunchActivatedEventArgs). The default implementation includes initial navigation support and state management through the SuspensionManager helper class.

All Application overrides involved in an activation scenario should call Activate() in their implementations.

Avoid performing tasks during launch if they could significantly increase the time required to launch your app. Instead, you can trigger additional loading tasks by listening for the Dismissed event.

The activation deferral object should not be used to complete complex tasks during activation. Any unhandled errors or exceptions that occur during activation (including deferred activation) will cause the app to crash. If you need to perform network calls or process a number of additional files during activation, consider launching your app to an extended splash screen and then performing these operations. For more information, see How to display a splash screen for an extended time.

Important

Apps that require an excessive amount of time to launch may be terminated by the system.

When testing your app, be aware that immediately reactivating an app that has just been terminated will result in a failed activation if the splash screen is still visible.

JavaScript launch completion

If programming with JavaScript, launch is complete when your activated event handler returns successfully after executing your launch tasks.

.NET launch completion

If programming with C#, VB, or C++, launch is complete when you activate an app window.

Properties

Arguments Arguments Arguments Arguments

Gets the arguments that are passed to the app during its launch activation.

public string Arguments { get; }public string Arguments { get; }Public ReadOnly Property Arguments As stringpublic string Arguments { get; }
Value
string string string string

The list of arguments. This value can be used to control the behavior of the app when it is launched through a secondary tile or through a toast.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

These arguments provide additional context for this activation. Similar to command-line arguments, this string can be parsed by an app to determine what action it should take in response to this activation. This argument string comes from a property such as Arguments or a toast's XML payload, through the launch attribute of the toast element or the arguments attribute of the command element.

Note

An app should always regard the arguments string as untrusted data and must parse and validate the string carefully before taking action based on its contents. Blindly using the arguments string without examining it first can present a security risk.

CurrentlyShownApplicationViewId CurrentlyShownApplicationViewId CurrentlyShownApplicationViewId CurrentlyShownApplicationViewId

Gets the identifier for the currently shown app view.

public int CurrentlyShownApplicationViewId { get; }public int CurrentlyShownApplicationViewId { get; }Public ReadOnly Property CurrentlyShownApplicationViewId As intpublic int CurrentlyShownApplicationViewId { get; }
Value
int int int int

The identifier for the currently shown app view.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Kind Kind Kind Kind

Gets the reason that this app is being activated.

public ActivationKind Kind { get; }public ActivationKind Kind { get; }Public ReadOnly Property Kind As ActivationKindpublic ActivationKind Kind { get; }
Value
ActivationKind ActivationKind ActivationKind ActivationKind

One of the enumeration values.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

PrelaunchActivated PrelaunchActivated PrelaunchActivated PrelaunchActivated

Indicates whether the app was pre-launched.

public bool PrelaunchActivated { get; }public bool PrelaunchActivated { get; }Public ReadOnly Property PrelaunchActivated As boolpublic bool PrelaunchActivated { get; }
Value
bool bool bool bool

Indicates whether the app was pre-launched. TRUE indicates it was; otherwise, FALSE.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

When available system resources allow, the startup performance of Windows Store app is improved by proactively launching the user’s most frequently used apps in the background. See Handle app prelaunch for details.

PreviousExecutionState PreviousExecutionState PreviousExecutionState PreviousExecutionState

Gets the execution state of the app before this activation.

public ApplicationExecutionState PreviousExecutionState { get; }public ApplicationExecutionState PreviousExecutionState { get; }Public ReadOnly Property PreviousExecutionState As ApplicationExecutionStatepublic ApplicationExecutionState PreviousExecutionState { get; }
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The app uses this information to determine whether it should restore saved state.

SplashScreen SplashScreen SplashScreen SplashScreen

Gets the splash screen object that provides information about the transition from the splash screen to the activated app.

public SplashScreen SplashScreen { get; }public SplashScreen SplashScreen { get; }Public ReadOnly Property SplashScreen As SplashScreenpublic SplashScreen SplashScreen { get; }
Value
SplashScreen SplashScreen SplashScreen SplashScreen

The object that provides splash screen information.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This property is only meaningful when the app is activated under a contract that expects a window to be presented. If the contract doesn't require a window or if the app is being activated for a background task, this call will fail.

You can listen for the Dismissed event to trigger additional loading tasks.

TileActivatedInfo TileActivatedInfo TileActivatedInfo TileActivatedInfo

Gets additional information that is provided when the user launches your app from a tile. This will be null if the app is not launched from its tile or if the app is launched on a platform that doesn't support this property.

public TileActivatedInfo TileActivatedInfo { get; }public TileActivatedInfo TileActivatedInfo { get; }Public ReadOnly Property TileActivatedInfo As TileActivatedInfopublic TileActivatedInfo TileActivatedInfo { get; }
Value
TileActivatedInfo TileActivatedInfo TileActivatedInfo TileActivatedInfo

Information about the tile that launched the app.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

TileId TileId TileId TileId

Gets the ID of the tile that was invoked to launch the app.

public string TileId { get; }public string TileId { get; }Public ReadOnly Property TileId As stringpublic string TileId { get; }
Value
string string string string

The ID of the tile that launched the app. If the app's main tile was used, this value is "App". If a secondary tile is used, the TileId value, assigned to the secondary tile when it was created, is returned.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Starting with Windows 10, TileId behavior is different for apps that are launched after having been terminated. Previously, the TileId always returned the ID of the tile that launched the app. The TileId behavior now depends on how the app is reactivated:

How the app is reactivatedBehavior of TileId
The user switches to the app by using the task switcher or by using the global back keyReturns the empty string ("").
The user taps the app tileReturns the tile ID.

The new behavior makes it possible to differentiate between a switch to the app versus a re-launch of the app. If your app uses tile ID information during activation, handle the TileId=="" case. For example:

protected override void OnLaunched(LaunchActivatedEventArgs e)
{
...
  if (e.TileId == "")
  {
    // resumed from switch/backstack
  }
  else
  {
    // resumed from tile launch
  }
...
}

User User User User

Gets the user that the app was activated for.

public User User { get; }public User User { get; }Public ReadOnly Property User As Userpublic User User { get; }
Value
User User User User

The user that the app was activated for.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

This property returns the logged-in user on platforms that only support single-user sessions. For platforms that support multiple users in a session (such as Xbox) this property returns the logged-in user that the app was activated for.

This property returns null when a multi-user application is activated with no specific user context.

Multi-user apps can use this property to allow or restrict app behavior. For example, you might restrict access to content or features based on the user’s credentials.

ViewSwitcher ViewSwitcher ViewSwitcher ViewSwitcher

Gets the view switcher object that allows you to set the view for the application.

public ActivationViewSwitcher ViewSwitcher { get; }public ActivationViewSwitcher ViewSwitcher { get; }Public ReadOnly Property ViewSwitcher As ActivationViewSwitcherpublic ActivationViewSwitcher ViewSwitcher { get; }
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)