Matthew
Matthew

Reputation: 366

Handling MediaCapture Suspend/Resume Windows Phone 8.1

I want to properly dispose the MediaCapture object when the user presses on the phone's Start or Back button. I presently handle the Back pressed event through the HardwareButtons.BackPressed event handler and dispose the MediaCapture object. When I re-enter the app however, the Resuming event is never called and I cannot recreate the MediaCapture object. I tried subscribing to Application.Current.Resuming for this but it is not called. I know my handler is functioning as when I play with the Lifecycle events in debug, the appropriate handlers are called. I also tried handling the OnNavigatedTo and OnNavigationLoadState but these do not get called either when the app is "resumed" from holding the Back button from the start menu and then tapping on my app.

I also need to know which event is called when a user presses the Start button from within the app. Both the OnSuspending and OnNavigationSaveState are not called during this event. Is there something similar to HardwareButtons.BackPressed for the Start button?

Upvotes: 0

Views: 338

Answers (1)

Matthew
Matthew

Reputation: 366

After looking at this stack question, I realized that the reason I was not seeing the Suspend / Resume event being triggered was because I was running the app in Debug mode. Normally, the Suspend event is fired when the user navigates away from the app. Resume is also called if you load the app from the app list.

Upvotes: 1

Related Questions