Cortana-OnActivated launching app from previous state NotRunning = hung.

Aug 26, 2015 at 5:05 PM
Edited Aug 26, 2015 at 5:06 PM
After a couple days googling/binging (as in binging and purging?) and not finding anything anywhere on using Cortana to launch a Universal Prism app in Windows Phone 8.1 I thought I'd give one final shot here.

If an app is running or suspended everything works as expected, which makes sense. It's all bootstrapped up and humming along nicely. It's when you want to start the app up after a OS restart, or manually closing the app that things get nasty.

From what I can find and my testing if you launch an app from a NotRunning state via Cortana you must override OnActivated because OnLaunched isn't called. The issues is I can't find a combination that will bootstrap the app from OnActivated so that the app will actually start. Calling InitializeFrameAsync(args) and then NavigationService.Navigate (after checking for ActivationKind and the code to determine which page to navigate to) just hangs at the splash screen until it times out and returns to Cortana. Calling OnLaunch manually makes it immediately dump back to Cortana.

I've tried this with essentially a blank app so I'm not loading anything special and have sent it to a blank page so that should rule out any of my code (since there is none of it).

The fun part is I can't see a way to actively debug it since I'm launching from a NotRunning state. I can get a MessageDialog coded into the page I'm navigating to to display, however it pops up over the Splash Screen and the frame never changes to the page. That leads me to believe that it's not fully bootstrapped with the InitializeFrameAsync, and so the Navigation
Service never completes it's task.


I'll keep plugging away at it and will post an answer if I find it. Next step is to go through the PRISM code and to start calling bits manually to see if I can find a combination that likes launching via OnActivated.