Docs contain wrong sample code?

TimoSchmidtTimoSchmidt DEMember ✭✭
edited November 2017 in General

https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/dependency-service/text-to-speech/#Android_Implementation

I think there's a bug in the sample code:

            toSpeak = text;
            if (speaker == null)
                speaker = new TextToSpeech(Forms.Context, this);
            else
            {
                var p = new Dictionary<string, string>();
                speaker.Speak(toSpeak, QueueMode.Flush, p);
            }

If speaker is null, a new speaker will be initialized, but the text will not be spoken.

Also, VS2017 tells me that "Speak" is deprecated.
Is there a chance to have both issues improved?

Edit: Oh, I just saw that the text will be spoken on "OnInit" when the speaker is initialized.

However, the deprecated code is still an issue.

Sign In or Register to comment.