private void App_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e) { // Make sure to stop the watcher on suspend. watcher.Stop(); // Always unregister the handlers to release the resources to prevent leaks. watcher.Received -= OnAdvertisementReceived; watcher.Stopped -= OnAdvertisementWatcherStopped; }