0
我想如果UWP中的語音識別能夠識別即使應用程序未處於活動狀態。UWP中的語音識別不能在後臺工作
我有這些設定目前:
async void InitializeSpeechRecognizer()
{
SpeechRecognizer speechRecognizer = new SpeechRecognizer();
speechRecognizer.StateChanged += HandleSpeech_State;
speechRecognizer.ContinuousRecognitionSession.ResultGenerated += HandleSpeech;
StorageFile grammar = await Package.Current.InstalledLocation.GetFileAsync(@"Grammar.xml"); // file
SpeechRecognitionGrammarFileConstraint grammarContraint = new SpeechRecognitionGrammarFileConstraint(grammar);
speechRecognizer.Constraints.Add(grammarContraint);
SpeechRecognitionCompilationResult compilantResult = await speechRecognizer.CompileConstraintsAsync(); // compile grammar
if (compilantResult.Status == SpeechRecognitionResultStatus.Success)
await speechRecognizer.ContinuousRecognitionSession.StartAsync();
}
InitializeSpeechRecognizer被稱爲
的MainPage當我啓動應用程序,我可以在調試窗口狀態的變化看。我激活之後另一個應用程序沒有任何事情發生:(
感謝您的任何想法
這是對.NET的Silverlight,而他正在開發一個應用程序UWP,後臺任務是在UWP應用程序使用。參見[支持,後臺任務您的應用程序(https://msdn.microsoft.com/EN-US /天秤座RY /窗/應用/ XAML/mt299103.aspx)。我甚至不認爲UWP應用程序的後臺任務可以解決這個問題。 –