Exception The speech privacy policy was not accepted prior to attempting a speech recognition

0 votes

From where do I have to accept the speech recognition policy?

This is the code

public async void display()
{
    SpeechRecognizer rec = new SpeechRecognizer();
    await rec.CompileConstraintsAsync();
    rec.Timeouts.InitialSilenceTimeout = TimeSpan.FromSeconds(5);
    rec.Timeouts.EndSilenceTimeout = TimeSpan.FromSeconds(20);
    rec.UIOptions.AudiblePrompt = "I am listening";
    rec.UIOptions.ShowConfirmation = true;
    rec.UIOptions.IsReadBackEnabled = true;
    rec.Timeouts.BabbleTimeout = TimeSpan.FromSeconds(5);
    SpeechRecognitionResult result = await rec.RecognizeAsync(); // Error here

    if (result!=null)
    {
        textBlock.Text= result.Text;
    }
}
Oct 1, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,068 views

1 answer to this question.

0 votes

There's a setting under Speech, Inking, and Typing. To get there, 

1. First, go to Settings and click "Time & Language". 

2. Select the "Speech" option.

3. Go to the "Speech, Inking & Typing privacy settings".

4. Then, click on the pop-up and turn the setting ON.

After that, any software that uses the Speech Recognition API will work.

A helpful way to tell users to turn on would be...

catch (System.Runtime.InteropServices.COMException e) when (e.HResult == unchecked((int)0x80045509))
//privacyPolicyHResult
//The speech privacy policy was not accepted prior to attempting a speech recognition.
{
    ContentDialog Dialog = new ContentDialog()
    {
        Title = "The speech privacy policy was not accepted",
        Content = "You need to turn on a button called 'Get to know me'...",
        PrimaryButtonText = "Shut up",
        SecondaryButtonText = "Shut up and show me the setting"
    };
    if (await Dialog.ShowAsync() == ContentDialogResult.Secondary)
    {
        const string uriToLaunch = "ms-settings:privacy-speechtyping";
        
        //"was-not-accepted-prior-to-attempting-a-spee/43083877#43083877";
        var uri = new Uri(uriToLaunch);

        var success = await Windows.System.Launcher.LaunchUriAsync(uri);

        if (!success) await new ContentDialog
        {
            Title = "Oops! Something went wrong...",
            Content = "The settings app could not be opened.",
            PrimaryButtonText = "Shut your mouth up!"
        }.ShowAsync();
    }
}

answered Oct 1, 2018 by Annie97
• 2,160 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer
0 votes
1 answer

Detecting when a sensor is not sending data to Orion CB in FiWARE

Orion in itself has no such mechanism ...READ MORE

answered Nov 22, 2018 in IoT (Internet of Things) by Shubham
• 13,490 points
747 views
0 votes
1 answer

What is the maximum message length for a MQTT broker?

It's not entirely clear what you're asking ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by anonymous2
• 4,240 points
9,462 views
0 votes
1 answer

Connect Android Things based Raspberry Pi 3 to wifi network for the first time!

Hey, I think its alright!  Your Raspberry Pi ...READ MORE

answered Jul 19, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,158 views
0 votes
1 answer

Deploy my Windows 10 IOT core application locally!

Of course, you, can! That is, in ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,109 views
0 votes
1 answer

Finding the Unicast, DNS and Gateway Address in UWP

Try the PInvoke api methods from Iphlpapi.dll. ...READ MORE

answered Aug 20, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
906 views
0 votes
1 answer

Using Sleep()/Delay() in C# on Windows IoT

You'll be glad to know that C# ...READ MORE

answered Aug 28, 2018 in IoT (Internet of Things) by DataKing99
• 8,250 points
2,262 views
0 votes
1 answer

TCP in Azure IoT Hub

The default Protocol Gateway samples are indeed ...READ MORE

answered Oct 11, 2018 in IoT (Internet of Things) by DataKing99
• 8,250 points
2,276 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP