2017-03-17 9 views
0

BackgroundApplication을 사용하여 Raspberry PI 3에서 음성 인식기를 구현하려고합니다. UWP에서 SpeechRecognizer 클래스를 사용하고 있습니다.ContinuousRecognitionSession.StartAsync() 반환 "액세스가 거부되었습니다."

나는이 오류 "액세스가 거부되었습니다"받을 때 호출이 기능 ContinuousRecognitionSession.StartAsync()

문제가 무엇입니까?

코드는 다음과 같습니다

class Speech 
{ 
    private static SpeechRecognizer speechRecognizer; 
    public async static void Initialize() 
    { 
     speechRecognizer = new SpeechRecognizer(); 
     speechRecognizer.Constraints.Add(new SpeechRecognitionListConstraint(new List<String>() { "Hello" }, "Hello")); 

     SpeechRecognitionCompilationResult compilationResult = await speechRecognizer.CompileConstraintsAsync(); 

     speechRecognizer.ContinuousRecognitionSession.ResultGenerated += ContinuousRecognitionSession_ResultGenerated; 
    } 

    private static void ContinuousRecognitionSession_ResultGenerated(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionResultGeneratedEventArgs args) 
    { 
     throw new NotImplementedException(); 
    } 

    public static async Task<bool> StartRecognition() 
    { 
     try 
     { 
      await speechRecognizer.ContinuousRecognitionSession.StartAsync(); 
     } 
     catch (Exception eException) 
     { 
      return false; 
     } 

     return true; 
    } 
} 

public sealed class StartupTask : IBackgroundTask 
{ 
    BackgroundTaskDeferral _deferral; 

    public async void Run(IBackgroundTaskInstance taskInstance) 
    { 
     _deferral = taskInstance.GetDeferral(); 
     Speech.Initialize(); 
     await Speech.StartRecognition(); 
    } 
} 
+0

microsoft 기능을 package.appxmanifest에 추가 했습니까? –

답변