0

I did the following: 1.launched my app 2.launched another app 3.tap on my app again (for instance taking it from the app list)

At step .3 I would expect to get a message callback, but I dont.

In the file App.xaml.cs, I added the method onResuming this

way:

public App()
{
        //this.askToBeOnLockScreen();
        this.createRegisterBgTask();

        this.InitializeComponent();

        this.Suspending += OnSuspending;
        this.Resuming += OnResuming;
    }

here I override the 2 methods:

    private void OnResuming(object sender, object e)
    {
        Debug.WriteLine("OnResuming ...................");
    }





    private void OnSuspending(object sender, SuspendingEventArgs e)
    {
        Debug.WriteLine("onsuspending ......................................................");
        var deferral = e.SuspendingOperation.GetDeferral();

        deferral.Complete();
    }

not even the onsuspending is called.

What am I doing wrong?

I am new to Windows store app

eeadev
  • 3,662
  • 8
  • 47
  • 100

1 Answers1

1

You are probably starting the app from Visual Studio and to trigger suspend/resume you are simply using the minimizing button from your app. This doesn't work for apps which are started from VS and have a debugger connected.

To simulate supend/resume use the lifecyle-events toolbar in Visual Studio. It looks like this:enter image description here

Don't worry if you don't find it, it will appear right after you started debugging your app in Viusal Studio.

Daniel Meixner
  • 1,829
  • 11
  • 10
  • I also started a bounty here: http://stackoverflow.com/questions/32229375/how-to-start-background-task-at-boot-windows-store-app – eeadev Sep 02 '15 at 10:43