2014-05-05 18 views
7

Chcę zintegrować polecenia głosowe Cortana z moją aplikacją Windows Phone. Wiem, że ostatnia aktualizacja aplikacji Wikipedia jest włączona w Cortana. W tym samym czasie nie mogę znaleźć żadnej dokumentacji dotyczącej interfejsu API Cortany. Czy ktoś wie, gdzie mogę go znaleźć?Czy dostępna jest dokumentacja API Cortana?

+1

Widziałem wiele artykułów na kanale 9 na ten temat. To może być dobry punkt wyjścia: http://channel9.msdn.com/coding4fun/blog/Cortana-show-me-how-I-can-add-you-to-my-apps Również: http: // www .wp7connect.com/2014/04/06/new-in-depth-cortana-build-session-showing-features-app-integration-video / –

Odpowiedz

4

Nie ma czegoś takiego jak Cortana API, przynajmniej teraz.

Co jest obecnie dostępny prosi Cortana na ogień swoją aplikację o cokolwiek parametr użytkownik mówi, więcej informacji na ten temat tutaj: http://msdn.microsoft.com/en-us/library/dn630430.aspx

Dlaczego mówię, że nie jest to API dla Cortana? Ponieważ nie możesz programowo zapytać Cortany o pogodę lub cokolwiek chcesz. To, co robisz, to powiedzieć Cortanie, żeby uruchomiła twoją aplikację i od tej pory to twoja aplikacja dostarcza użytkownikowi potrzebnych informacji zwrotnych, informacji lub czegokolwiek innego.

1

można zintegrować Cortana do aplikacji przez:

Tworzenie Definicje polecenia głosowego (VCD)

<?xml version="1.0" encoding="utf-8" ?> 
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.1"> 
    <CommandSet xml:lang="en-us" Name="HomeControlCommandSet_en-us"> 
    <CommandPrefix>HomeControl</CommandPrefix> 
    <Example>Control alarm, temperature, light and others</Example> 

    <Command Name="Activate_Alarm"> 
     <Example>Activate alarm</Example> 
     <ListenFor>[Would] [you] [please] activate [the] alarm [please]</ListenFor> 
     <ListenFor RequireAppName="BeforeOrAfterPhrase">Activate alarm</ListenFor> 
     <Feedback>Activating alarm</Feedback> 
     <Navigate /> 
    </Command> 

    <Command Name="Change_Temperature"> 
     <Example>Change temperature to 25º degrees</Example> 
     <ListenFor>Change temperature to {temperature} degrees</ListenFor> 
     <Feedback>Changing temperature to {temperature} degrees</Feedback> 
     <Navigate /> 
    </Command> 

    <Command Name="Change_Light_Color"> 
     <Example>Change light color to yellow</Example> 
     <ListenFor>Change light color to {colors}</ListenFor> 
     <Feedback>Changing light color to {colors}</Feedback> 
     <Navigate /> 
    </Command> 

    <PhraseList Label="colors"> 
     <Item>yellow</Item> 
     <Item>green</Item> 
     <Item>red</Item> 
    </PhraseList> 

    <PhraseTopic Label="temperature"> 
    </PhraseTopic> 

    </CommandSet> 
</VoiceCommands> 

Rejestrowanie VCD w App Uruchomienie

StorageFile vcdStorageFile = await Package.Current.InstalledLocation.GetFileAsync(@"HomeControlCommands.xml"); 
await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(vcdStorageFile); 

obchodzenia polecenia

protected override void OnActivated(IActivatedEventArgs e) 
{ 
    // Handle when app is launched by Cortana 
    if (e.Kind == ActivationKind.VoiceCommand) 
    { 
     VoiceCommandActivatedEventArgs commandArgs = e as VoiceCommandActivatedEventArgs; 
     SpeechRecognitionResult speechRecognitionResult = commandArgs.Result; 

     string voiceCommandName = speechRecognitionResult.RulePath[0]; 
     string textSpoken = speechRecognitionResult.Text; 
     IReadOnlyList<string> recognizedVoiceCommandPhrases; 

     System.Diagnostics.Debug.WriteLine("voiceCommandName: " + voiceCommandName); 
     System.Diagnostics.Debug.WriteLine("textSpoken: " + textSpoken); 

     switch (voiceCommandName) 
     ... 
} 

można znaleźć więcej informacji na http://talkitbr.com/2015/07/13/integrando-a-cortana-em-seu-aplicativo-windows-10/

Ponadto, jeśli zainteresowany reagują na użytkownika przez okno Cortana, zaznacz to post dotyczące Cortana w tle.

Powiązane problemy