1

I am developing Windows phone 8.1 RT app.

Scenario:

When app is in Foreground, By long pressing Back arrow button, Move the app to Background and Select other app in the phone, do some activity on the other app, Then by long pressing Back arrow button again, now we get list of apps. I have choosen my app.

I have noticed, OnActivated, Suspending and Resuming events not fired at all. I have checked in both debug and release mode. These events are not fired at all.

I want to perform some activity when app comes to Foreground from Background.

What is the solution for this?

user1343947
  • 31
  • 1
  • 4
  • 1
    Check similar issue in this post http://stackoverflow.com/questions/24249159/detecting-deactivation-and-app-close-in-windows-phone-8-1-xaml?rq=1 – asitis Apr 01 '16 at 06:00

2 Answers2

1

Try using Lifecycle Events dropdown to switch between different lifecycle states.

enter image description here

Muhammad Hassan
  • 1,037
  • 1
  • 8
  • 22
0

Normally when you run the app without the debugger attached, the suspending event will be raised shortly after you choose the other app. When you debug the app, the lifecycle events are not being fired, you will have to invoke them as M.Hassan has mentioned.

Another two events that you may consider are Window.VisibilityChanged and Window.Activated of your app's window class. They both will be fired as you long press the back button, but they aren't the best choice for long running tasks - you should use suspending event for those. Also note that this events may be raised in some other situations.

Community
  • 1
  • 1
Romasz
  • 29,662
  • 13
  • 79
  • 154