olavo.mayer
olavo.mayer

Reputation: 13

Speech Recognition in Flutter - language selection

I'm trying to implement a Speech Recognition feature in my Flutter app using the speech_recognition package.

It works well except I need it to always recognize English instead of the user's device language on Android devices.

From what I researched, this can either be done by sending the user to settings and asking them to download the English language (not the best user experience) or by using APIs (Google cloud /firebase seems to offer that).

Since I've never used APIs before I thought it would be a good idea to check here before jumping in.

Question: Any alternative ideas on the best approach for implementing this English Speech-to-Text functionality in a Flutter app for Android?

Upvotes: 0

Views: 2276

Answers (1)

Looi Kian Seng
Looi Kian Seng

Reputation: 11

You can change the code in SpeechRecognitionPlugin.java at line 67 from

recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, call.arguments.toString());

to

recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");

can refer this https://stackoverflow.com/a/33029808

Hope it helps.

Upvotes: 1

Related Questions