VoiceCommandServiceConnection VoiceCommandServiceConnection VoiceCommandServiceConnection VoiceCommandServiceConnection Class

Definition

The background app service connection to Cortana.

Used to retrieve the voice command from Cortana and present messages that are spoken by Cortana and shown on the Cortana canvas.

public : sealed class VoiceCommandServiceConnection : IVoiceCommandServiceConnectionpublic sealed class VoiceCommandServiceConnection : IVoiceCommandServiceConnectionPublic NotInheritable Class VoiceCommandServiceConnection Implements IVoiceCommandServiceConnection// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Properties

Language Language Language Language

Gets the locale for the voice command.

public : Language Language { get; }public Language Language { get; }Public ReadOnly Property Language As Language// You can use this property in JavaScript.
Value
Language Language Language Language

The locale for the voice command.

See Also

Methods

FromAppServiceTriggerDetails(AppServiceTriggerDetails) FromAppServiceTriggerDetails(AppServiceTriggerDetails) FromAppServiceTriggerDetails(AppServiceTriggerDetails) FromAppServiceTriggerDetails(AppServiceTriggerDetails)

Retrieves a VoiceCommandServiceConnection object from the AppServiceTriggerDetails that contains info associated with the background task for the app service.

public : static VoiceCommandServiceConnection FromAppServiceTriggerDetails(AppServiceTriggerDetails triggerDetails)public static VoiceCommandServiceConnection FromAppServiceTriggerDetails(AppServiceTriggerDetails triggerDetails)Public Static Function FromAppServiceTriggerDetails(triggerDetails As AppServiceTriggerDetails) As VoiceCommandServiceConnection// You can use this method in JavaScript.
Parameters
triggerDetails
AppServiceTriggerDetails AppServiceTriggerDetails AppServiceTriggerDetails AppServiceTriggerDetails

Contains info associated with the background task for the app service.

Returns
See Also

GetVoiceCommandAsync() GetVoiceCommandAsync() GetVoiceCommandAsync() GetVoiceCommandAsync()

Retrieves the voice command that the user submitted to Cortana by voice or text.

public : IAsyncOperation<VoiceCommand> GetVoiceCommandAsync()public IAsyncOperation<VoiceCommand> GetVoiceCommandAsync()Public Function GetVoiceCommandAsync() As IAsyncOperation( Of VoiceCommand )// You can use this method in JavaScript.
Returns
See Also

ReportFailureAsync(VoiceCommandResponse) ReportFailureAsync(VoiceCommandResponse) ReportFailureAsync(VoiceCommandResponse) ReportFailureAsync(VoiceCommandResponse)

Sends a response to Cortana indicating the voice command has failed.

public : IAsyncAction ReportFailureAsync(VoiceCommandResponse response)public IAsyncAction ReportFailureAsync(VoiceCommandResponse response)Public Function ReportFailureAsync(response As VoiceCommandResponse) As IAsyncAction// You can use this method in JavaScript.
Parameters
response
VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse

The response from a background app service for progress, confirmation, disambiguation, completion, or failure screens displayed on the Cortana canvas.

Returns

An asynchronous handler called when the operation is complete.

See Also

ReportProgressAsync(VoiceCommandResponse) ReportProgressAsync(VoiceCommandResponse) ReportProgressAsync(VoiceCommandResponse) ReportProgressAsync(VoiceCommandResponse)

Sends a response to Cortana indicating voice command is being processed.

public : IAsyncAction ReportProgressAsync(VoiceCommandResponse response)public IAsyncAction ReportProgressAsync(VoiceCommandResponse response)Public Function ReportProgressAsync(response As VoiceCommandResponse) As IAsyncAction// You can use this method in JavaScript.
Parameters
response
VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse

The response from a background app service for progress, confirmation, disambiguation, completion, or failure screens displayed on the Cortana canvas.

Returns

An asynchronous handler called when the operation is complete.

Remarks

Cortana presents the progress screen to the user for up to 5 seconds. The background app service send another progress message by calling ReportProgressAsync again, or move to the next screen in the interaction flow (confirmation, disambiguation, or completion).

See Also

ReportSuccessAsync(VoiceCommandResponse) ReportSuccessAsync(VoiceCommandResponse) ReportSuccessAsync(VoiceCommandResponse) ReportSuccessAsync(VoiceCommandResponse)

Sends a response to Cortana indicating the voice command has succeeded.

public : IAsyncAction ReportSuccessAsync(VoiceCommandResponse response)public IAsyncAction ReportSuccessAsync(VoiceCommandResponse response)Public Function ReportSuccessAsync(response As VoiceCommandResponse) As IAsyncAction// You can use this method in JavaScript.
Parameters
response
VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse

The response from a background app service for progress, confirmation, disambiguation, completion, or failure screens displayed on the Cortana canvas.

Returns

An asynchronous handler called when the operation is complete.

See Also

RequestAppLaunchAsync(VoiceCommandResponse) RequestAppLaunchAsync(VoiceCommandResponse) RequestAppLaunchAsync(VoiceCommandResponse) RequestAppLaunchAsync(VoiceCommandResponse)

Sends a response to Cortana indicating the command should be handled by the app in the foreground.

public : IAsyncAction RequestAppLaunchAsync(VoiceCommandResponse response)public IAsyncAction RequestAppLaunchAsync(VoiceCommandResponse response)Public Function RequestAppLaunchAsync(response As VoiceCommandResponse) As IAsyncAction// You can use this method in JavaScript.
Parameters
response
VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse

The response from a background app service for progress, confirmation, disambiguation, completion, or failure screens displayed on the Cortana canvas.

Returns

An asynchronous handler called when the operation is complete.

Remarks

To enable deep linking to an app, declare the windows.personalAssistantLaunch extension in the Package.appxmanifest file of the app project.

An app is launched to the foreground through Uniform Resource Identifier (URI) activation using a Protocol contract. The app must override the OnActivated event and check for an ActivationKind of Protocol. See Handle URI activation for more info.

Cortana terminates the background app service and launches the app in foreground with the launch parameter provided by the app.

See Also

RequestConfirmationAsync(VoiceCommandResponse) RequestConfirmationAsync(VoiceCommandResponse) RequestConfirmationAsync(VoiceCommandResponse) RequestConfirmationAsync(VoiceCommandResponse)

Sends a response to Cortana indicating the voice command requires confirmation.

public : IAsyncOperation<VoiceCommandConfirmationResult> RequestConfirmationAsync(VoiceCommandResponse response)public IAsyncOperation<VoiceCommandConfirmationResult> RequestConfirmationAsync(VoiceCommandResponse response)Public Function RequestConfirmationAsync(response As VoiceCommandResponse) As IAsyncOperation( Of VoiceCommandConfirmationResult )// You can use this method in JavaScript.
Parameters
response
VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse

The response from a background app service for progress, confirmation, disambiguation, completion, or failure screens displayed on the Cortana canvas.

Returns
See Also

RequestDisambiguationAsync(VoiceCommandResponse) RequestDisambiguationAsync(VoiceCommandResponse) RequestDisambiguationAsync(VoiceCommandResponse) RequestDisambiguationAsync(VoiceCommandResponse)

Sends a response to Cortana indicating the voice command returned more than one result and requires the user to select one.

public : IAsyncOperation<VoiceCommandDisambiguationResult> RequestDisambiguationAsync(VoiceCommandResponse response)public IAsyncOperation<VoiceCommandDisambiguationResult> RequestDisambiguationAsync(VoiceCommandResponse response)Public Function RequestDisambiguationAsync(response As VoiceCommandResponse) As IAsyncOperation( Of VoiceCommandDisambiguationResult )// You can use this method in JavaScript.
Parameters
response
VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse VoiceCommandResponse

The response from a background app service for progress, confirmation, disambiguation, completion, or failure screens displayed on the Cortana canvas.

Returns
See Also

Events

VoiceCommandCompleted VoiceCommandCompleted VoiceCommandCompleted VoiceCommandCompleted

Event raised when the voice command is completed and the background app service is about to be terminated.

public : event TypedEventHandler VoiceCommandCompleted<VoiceCommandServiceConnection,  VoiceCommandCompletedEventArgs>public event TypedEventHandler VoiceCommandCompleted<VoiceCommandServiceConnection,  VoiceCommandCompletedEventArgs>Public Event VoiceCommandCompleted<VoiceCommandServiceConnection,  VoiceCommandCompletedEventArgs>// You can use this event in JavaScript.
See Also

See Also