Android text-to-speech implementation
Now let's implement the IoC container and text to speech for Android. Start by creating a folder for the both the Android Modules and Services, add in two files to it, TextToSpeechDroid.cs
and DroidModule.cs
.
Let's start with the text to speech service; for TextToSpeechDroid.cs
. And add the following:
public class TextToSpeechDroid : Java.Lang.Object, ITextToSpeech, Android.Speech.Tts.TextToSpeech.IOnInitListener { private Android.Speech.Tts.TextToSpeech _speaker; private string _toSpeak; public void Speak (string msg) { var ctx = Forms.Context; _toSpeak = msg; if (_speaker == null) { _speaker = new Android.Speech.Tts.TextToSpeech (ctx, this); } else { var p = new Dictionary<string,string>...