Muhammad Nasir Khan
Muhammad Nasir Khan

Reputation: 59

Windows Phone 8 speech recognition exception

I am working on a windows phone 8 app. I am facing problem in speech recognition. This is my code.

SpeechRecognizerUI recoWithUI= new SpeechRecognizerUI();
try
{
    this.recoWithUI = new SpeechRecognizerUI();

    // Start recognition (load the dictation grammar by default).
    SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();

    // Do something with the recognition result.
    MessageBox.Show(string.Format("You said {0}.", recoResult.RecognitionResult.Text));

}
catch (Exception)
{

    throw;
}

Every time I run it, It goes to App.xaml.cs class and points out this problem

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
    if (Debugger.IsAttached)
    {
        // An unhandled exception has occurred; break into the debugger
        Debugger.Break(); // It focuses on this line.
    }
}

Have you any idea how to resolve this problem ? Thanks

Upvotes: 0

Views: 131

Answers (2)

Muhammad Nasir Khan
Muhammad Nasir Khan

Reputation: 59

Ok so i got the problem Every thing is ok. No problem in the code The problem is SpeechRecognizerUI class language is en-Us but my phone language was en-UK so what i did is Just change my Phone language to en-Us and now it works. Thanks

Upvotes: 1

vixez
vixez

Reputation: 857

Have you enabled the Microphone capability in the WMAppManifest.xml file?

Open WMAppManifest.xml > Capabilities tab > check ID_CAP_MICROPHONE.

Upvotes: 0

Related Questions