Created
July 5, 2017 22:20
-
-
Save JoaoCnh/517105e6b4e092c1ffe5c660e6b89b03 to your computer and use it in GitHub Desktop.
react-native-android-voice example
This file contains hidden or 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
// Import the package | |
import SpeechAndroid from 'react-native-android-voice'; | |
... | |
async _buttonClick() { | |
try{ | |
// THIS EASY! | |
var spokenText = await SpeechAndroid.startSpeech("Speak into the Mic!", SpeechAndroid.GERMAN); | |
ToastAndroid.show(spokenText , ToastAndroid.LONG); | |
}catch(error){ | |
// DO WHATEVER YOU WANT WITH THE PACKAGE ERROR CODES | |
} | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment