Vladislav
Vladislav

Reputation: 297

How to subscribe on Activated event in a Windows Phone 8.1

Do anyone know, how to subscribe on Activated event in a Windows Phone 8.1 Universal App?

In Windows Phone 8, I have used:

PhoneApplicationService.Current.Activated +=

Upvotes: 1

Views: 1532

Answers (2)

Romasz
Romasz

Reputation: 29792

WP8.1 Runtime has little different lifecycle - see MSDN. Depending on your needs you can use:

  • App.Current.Resuming event is called when you resume your app after it had been suspended by the OS - very often, typically few seconds after you navigate away, see also How to Resume an app,
  • Windows.Current.Activated is called when Window is activated/deactivated - you will have to check event's args. This event doesn't mean that your app had been suspended. You should also look out because this event will be fired for example when you show a dialog (when your window loses focus).
  • override methods from Application class - after using file pickers, sharing a target and more.

Upvotes: 3

Muhammad Saifullah
Muhammad Saifullah

Reputation: 4292

In windows phone 8.1 universal app use following code to subscribe for activated event.

 Window.Current.Activated += Current_Activated;

Hope this helps!

Upvotes: 0

Related Questions