How to Use SpeechRecognizer in Windows Phone App using C#?

Published on October 1, 2013 by Senthil Kumar

Filed under Windows Phone

Last modified October 1, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 10560 times

Below is a sample code snippet demonstrating how to use the SpeechRecognizerUI in your Windows Phone app using C#.

Note that by default the speech recognizer API uses the default speech grammar accessed via the Microsoft cloud service and hence requires the network connection to be available for the below code snippet to work.

How to Use SpeechRecognizer in Windows Phone App using C#?

async private void Button_Click_1(object sender, RoutedEventArgs e)


SpeechRecognizerUI speech = new SpeechRecognizerUI();

await speech.Recognizer.PreloadGrammarsAsync();

SpeechRecognitionUIResult result = await speech.RecognizeWithUIAsync();

if (result.ResultStatus == SpeechRecognitionUIStatus.Succeeded)





When the speech.RecognizeWithUIAsync is called, the SDK provides a dialog which will prompt the user to speak.

Once the SpeechRecognitionUIResult returns the SpeechRecognitionUIStatus.Succeeded, the RecognitionResult.Text will contain the text that was spoken.

1 Comment

  1. Nasir

    Sir I has a problem
    when i run the same code in my project (windows phone 8.1) it redirects me to App.xaml.cs class and points to

    private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
    if (Debugger.IsAttached)
    // An unhandled exception has occurred; break into the debugger
    Debugger.Break(); // this line
    can you please help me out ?

    October 30, 2014 - 11:05 pm – Reply

Leave a Comment


You might be Interested in these Posts

C Program to convert lower case string to upper case

Problem Statement Write a program in C to convert the given string from lower case to upper case. ...

How to decode a base64 string in C#?

Here's a sample code snippet demonstrating how you can easily decode a base64 encoded string in C#. ...

How to disable editing of items in a combo box in c#?

When working in Win forms using C# and especially when you use the combo box , you would have notice...