/// <summary> /// Obsolete method call for TTS, necessary for legacy devices /// </summary> /// <param name="text"></param> private void ApiUnder20(string text) { System.Collections.Generic.Dictionary <string, string> map = new System.Collections.Generic.Dictionary <string, string>(); map.Add(Android.Speech.Tts.TextToSpeech.Engine.KeyParamUtteranceId, "MessageId"); #pragma warning disable CS0618 // Legacy support speaker.Speak(text, Android.Speech.Tts.QueueMode.Flush, map); #pragma warning restore CS0618 }
public void Speak(string text_to_speak) { var ctx = Xamarin.Forms.Forms.Context; if (speaker == null) { speaker = new Android.Speech.Tts.TextToSpeech(ctx, this); } else { Dictionary <string, string> p = new Dictionary <string, string>(); speaker.Speak(text_to_speak, Android.Speech.Tts.QueueMode.Flush, p); } return; }