imgen
imgen

Reputation: 3133

SpeechSynthesizer.SpeakTextAsync throws UnauthorizedAccessException in PeriodicScheduledTask of my agent project

Just as titled, I get the UnauthorizedAccessException error when try to call SpeechSynthesizer.SpeakTextAsync from the OnInvoke method of my PeriodicScheduledTask. In the main project, I already added the ID_CAP_SPEECH_RECOGNITION flag. Anything else I need to do?

Upvotes: 0

Views: 115

Answers (1)

Robert McLaws
Robert McLaws

Reputation: 2622

You cannot call Speech Synthesis from a background agent, hence the exception. You can't just have your phone randomly start talking to you. You CAN create a toast notification that they click, which activates your app and navigates to a specific page... At that point you should be able to use speech just fine.

HTH!

Upvotes: 1

Related Questions