I am looking forward to make Cortana redirect custom commands to my app (Cortana API Integration).
Commands.xml
<?xml version="1.0" encoding="utf-8"?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.1">
<CommandSet xml:lang="en-us" >
<CommandPrefix>Computer</CommandPrefix>
<Example> who are the indians </Example>
<Command Name="Origins">
<Example> who are the indians </Example>
<ListenFor> who are the {tribe} </ListenFor>
<Feedback> looking for {tribe} </Feedback>
<Navigate/>
</Command>
<PhraseTopic Label="tribe" Scenario="Tribe Info">
<Subject> Tribe </Subject>
</PhraseTopic>
</CommandSet>
</VoiceCommands>
Extract of App.xaml.cs
protected async override void OnLaunched(LaunchActivatedEventArgs e)
{
try
{
var storageFile =
await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(
new Uri("ms-appx:///Commands.xml"));
await Windows.Media.SpeechRecognition.VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
}
catch (Exception)
{
System.Diagnostics.Debug.WriteLine("Failed");
MessageDialog msg = new MessageDialog("Problem chief.");
msg.ShowAsync();
//throw;
}
}
I have also turned on Microphone capabilities in the manifest file. I am running VS 2015, and debug it directly onto my device lumia 525 which runs windows 8.1. The app installs normally (and since I haven't added any UI part it shows a simple black screen) doesn't crash and the debug doesn't show anything unusual.
'App6.exe' (CoreCLR: DefaultDomain): Loaded 'C:\windows\system32\mscorlib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'App6.exe' (CoreCLR: .): Loaded 'D:\WPSystem\APPREPOSITORY\d8c976b1-9b9b-47a3-8b2c-8f6dc74eeee5_1.0.0.0_neutral__2f5008nxamf4t\NI\App6.ni.EXE'. Symbols loaded.
'App6.exe' (CoreCLR: .): Loaded 'C:\windows\system32\WinMetadata\Windows.winmd'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'App6.exe' (CoreCLR: .): Loaded 'C:\windows\system32\System.Runtime.WindowsRuntime.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'App6.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'App6.exe' (CoreCLR: .): Loaded 'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built without symbols.
The thread 0xf44 has exited with code 0 (0x0).
The Cortana doesn't feature my command in "What can I say?" list nor does it respond to the commands.