Carl Patenaude Poulin Carl Patenaude Poulin - 1 year ago 229
Javascript Question

How can I develop a Cortana app in JavaScript?

I would like to develop a Cortana application in HTML/JavaScript/CSS. Unfortunately, all the documentation pertaining to Cortana apps is written for C#/XAML.

Answer Source

To integrate with Cortana, you need to develop a Universal Windows Platform (UWP) app which exposes an "App Service" that integrates with Cortana.

In Visual Studio 2015 (or Visual Studio 15), create a new project using the JavaScript project template "Blank App (Universal Windows)". Find the element with tag Application, and add the following as a child element:

  <!-- Provide a hook for Cortana to ask your app questions -->
  <uap:Extension Category="windows.appService" StartPage="voiceCommandService.js"> 
    <uap:AppService Name="AdventureWorksVoiceCommandService"/> 
  <!-- Enable deep linking into your app from Cortana -->
  <uap:Extension Category="windows.personalAssistantLaunch"/>

The file voiceCommandService.js will then serve as an entry point for Cortana. It will be executed whenever Cortana hands off a request to your app, and you'll be able to get the task details from Windows.UI.WebUI.WebUIBackgroundTaskInstance.current.

For the rest, just follow the C# documentation.

Answer based on this Cortana sample.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download