[Devs] I wonder what Cortana's API is going to be like

Amrykid

Banned
Apr 17, 2014
29
0
0
Visit site
I hope MS will introduce something along the lines of "Cortana Background Agents". It would allow developers to introduce commands without having to start an application. A good example would be a dictionary definition app or a WolframAlpha app.

You could say "define 'cool'" which would trigger a dictionary defining background agent.

Code wise, it might look like this:
Code:
using System;

public class DictionaryDefinitionAgent: CortanaBackgroundAgent
{
    public override Task InvokeAsync(CortanaWrapper cortana, SpeechAgentInvokedEventArgs args)
    {
        //Entry point for the background agent.
        var deferral = await args.GetDeferral(); .//We know this task may take longer than 3 seconds so let the system know this. Cortana could say "hold on a second".
        var wordToDefine = args.Arguments[0]; //Get "cool"

        //insert magic code to get definition here

        cortana.Say("The definition of {0} is \"{1}\", wordToDefine, definition); //tell Cortana to say the definition
        deferral.Complete();
    }
}

The code above will grab the definition for the specified word and show it from inside of Cortana, without starting a dictionary app or performing a Bing search. There are other uses for this such as a calculator or a custom Google search.

Perhaps we can set triggers that would allow these agents to run at start-up (and limit it to one, specified by the user). It could be used to say or name or something.

I don't know, I just can't wait for the API to be released (if it hasn't already). What do you guys (and gals) think?
 

Members online

No members online now.

Forum statistics

Threads
323,278
Messages
2,243,563
Members
428,055
Latest member
graceevans