Created
August 25, 2018 14:25
-
-
Save dev-aritra/2414d10c6db5ad6aad3a1c3a241b550b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void AskForSpeechPermission() | |
{ | |
SFSpeechRecognizer.RequestAuthorization((SFSpeechRecognizerAuthorizationStatus status) => | |
{ | |
switch (status) | |
{ | |
case SFSpeechRecognizerAuthorizationStatus.Authorized: | |
MessagingCenter.Send<ISpeechToText>(this, "Authorized"); | |
break; | |
case SFSpeechRecognizerAuthorizationStatus.Denied: | |
throw new Exception("Audio permission denied"); | |
case SFSpeechRecognizerAuthorizationStatus.NotDetermined: | |
throw new Exception("Audio permission not available"); | |
case SFSpeechRecognizerAuthorizationStatus.Restricted: | |
throw new Exception("Audio permission denied"); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment