How to set the language in speech recognition on android?











up vote
17
down vote

favorite
14












I've been working on speech Recognition API in android and found out that the speech results vary allot when the language settings are changed , is there a way to set it programmatically ? or is there an intent to lunch the speech language settings screen ? or what else ?
note:
I tried to use this intent extra:



intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en-US");


but it was ineffective










share|improve this question






















  • intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getDefault()); ..it will run if gooogle support that language..
    – Xar E Ahmer
    May 29 '14 at 10:27










  • The extra that is supposed to serve that purpose is EXTRA_LANGUAGE, not EXTRA_LANGUAGE_PREFERENCE. However, LANGUAGE_EXTRA for some reason only works until 4.3. Starting from 4.4, Android allows multiple languages to be selected in Settings, and will always try to "guess" the language according to system settings and completely ignores the EXTRA_LANGUAGE extra. So, anybody?
    – matteo
    Sep 5 '14 at 16:38















up vote
17
down vote

favorite
14












I've been working on speech Recognition API in android and found out that the speech results vary allot when the language settings are changed , is there a way to set it programmatically ? or is there an intent to lunch the speech language settings screen ? or what else ?
note:
I tried to use this intent extra:



intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en-US");


but it was ineffective










share|improve this question






















  • intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getDefault()); ..it will run if gooogle support that language..
    – Xar E Ahmer
    May 29 '14 at 10:27










  • The extra that is supposed to serve that purpose is EXTRA_LANGUAGE, not EXTRA_LANGUAGE_PREFERENCE. However, LANGUAGE_EXTRA for some reason only works until 4.3. Starting from 4.4, Android allows multiple languages to be selected in Settings, and will always try to "guess" the language according to system settings and completely ignores the EXTRA_LANGUAGE extra. So, anybody?
    – matteo
    Sep 5 '14 at 16:38













up vote
17
down vote

favorite
14









up vote
17
down vote

favorite
14






14





I've been working on speech Recognition API in android and found out that the speech results vary allot when the language settings are changed , is there a way to set it programmatically ? or is there an intent to lunch the speech language settings screen ? or what else ?
note:
I tried to use this intent extra:



intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en-US");


but it was ineffective










share|improve this question













I've been working on speech Recognition API in android and found out that the speech results vary allot when the language settings are changed , is there a way to set it programmatically ? or is there an intent to lunch the speech language settings screen ? or what else ?
note:
I tried to use this intent extra:



intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en-US");


but it was ineffective







android speech-recognition






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 10 '12 at 16:54









Mr.Me

7,57652949




7,57652949












  • intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getDefault()); ..it will run if gooogle support that language..
    – Xar E Ahmer
    May 29 '14 at 10:27










  • The extra that is supposed to serve that purpose is EXTRA_LANGUAGE, not EXTRA_LANGUAGE_PREFERENCE. However, LANGUAGE_EXTRA for some reason only works until 4.3. Starting from 4.4, Android allows multiple languages to be selected in Settings, and will always try to "guess" the language according to system settings and completely ignores the EXTRA_LANGUAGE extra. So, anybody?
    – matteo
    Sep 5 '14 at 16:38


















  • intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getDefault()); ..it will run if gooogle support that language..
    – Xar E Ahmer
    May 29 '14 at 10:27










  • The extra that is supposed to serve that purpose is EXTRA_LANGUAGE, not EXTRA_LANGUAGE_PREFERENCE. However, LANGUAGE_EXTRA for some reason only works until 4.3. Starting from 4.4, Android allows multiple languages to be selected in Settings, and will always try to "guess" the language according to system settings and completely ignores the EXTRA_LANGUAGE extra. So, anybody?
    – matteo
    Sep 5 '14 at 16:38
















intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getDefault()); ..it will run if gooogle support that language..
– Xar E Ahmer
May 29 '14 at 10:27




intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, Locale.getDefault()); ..it will run if gooogle support that language..
– Xar E Ahmer
May 29 '14 at 10:27












The extra that is supposed to serve that purpose is EXTRA_LANGUAGE, not EXTRA_LANGUAGE_PREFERENCE. However, LANGUAGE_EXTRA for some reason only works until 4.3. Starting from 4.4, Android allows multiple languages to be selected in Settings, and will always try to "guess" the language according to system settings and completely ignores the EXTRA_LANGUAGE extra. So, anybody?
– matteo
Sep 5 '14 at 16:38




The extra that is supposed to serve that purpose is EXTRA_LANGUAGE, not EXTRA_LANGUAGE_PREFERENCE. However, LANGUAGE_EXTRA for some reason only works until 4.3. Starting from 4.4, Android allows multiple languages to be selected in Settings, and will always try to "guess" the language according to system settings and completely ignores the EXTRA_LANGUAGE extra. So, anybody?
– matteo
Sep 5 '14 at 16:38












8 Answers
8






active

oldest

votes

















up vote
43
down vote



accepted










As pargat says, this will do it:



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


Also, your app can query for the list of supported languages by sending a RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS ordered broadcast like so:



    Intent detailsIntent =  new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
sendOrderedBroadcast(
detailsIntent, null, new LanguageDetailsChecker(), null, Activity.RESULT_OK, null, null);


where LanguageDetailsChecker is something like this:



public class LanguageDetailsChecker extends BroadcastReceiver
{
private List<String> supportedLanguages;

private String languagePreference;

@Override
public void onReceive(Context context, Intent intent)
{
Bundle results = getResultExtras(true);
if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE))
{
languagePreference =
results.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE);
}
if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES))
{
supportedLanguages =
results.getStringArrayList(
RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);
}
}
}


For the complete code check out this github project:
https://github.com/gast-lib






share|improve this answer























  • Thanks for the full package
    – Mr.Me
    May 12 '12 at 18:42






  • 2




    I think it easier to use RecognizerIntent method for creating the intent: ` val detailsIntent = RecognizerIntent.getVoiceDetailsIntent(context) activity.sendOrderedBroadcast(detailsIntent, null, LanguageDetailsChecker({ languages.accept(it) }), null, Activity.RESULT_OK, null, null)` Intent from the sample above didn't work for me :( getVoiceDetailsIntent() did :)
    – Aetherna
    Nov 20 '17 at 15:04












  • Putting "en-US" doesn't work for me. Use intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString()); as suggested in the answer by @orina1123
    – M3RS
    Jul 16 at 13:20




















up vote
12
down vote













there is no solution but a hackaround...



intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String{"en"});


check here the complete story.






share|improve this answer

















  • 2




    Dude I don't know why you had only 1 point but this is definitely a correct answer. Thanks a lot.
    – TacB0sS
    Dec 14 '14 at 15:11






  • 1




    @TacB0sS people like long answers...well i am glad it helped you.
    – Arnav M.
    Dec 15 '14 at 4:18






  • 1




    most useful answer i ever get ! really.
    – Behnam Esmaili
    Dec 12 '16 at 10:20


















up vote
9
down vote













This will work:



intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en_US");


You have to use "en_US" instead of "en-US". The former is the right format of Java locale tag.



It is suggested that you use



intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString());


to avoid remembering such detail.






share|improve this answer





















  • Thanks, man. This saved hours of the time of mine!!! The problem was similar but little difference. Can find it here stackoverflow.com/questions/51048466/…
    – Varun A M
    Jun 27 at 7:05




















up vote
8
down vote













Have you tried this:



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





share|improve this answer




























    up vote
    6
    down vote













    I finally got my app to restrict voice recognition results to a specified language input (handing it, e.g., "ja" for Japanese or "fr" for French) by adding all 3 of the following extras:



    String languagePref = "de";//or, whatever iso code...
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, languagePref);
    intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, languagePref);


    Hope this helps someone.






    share|improve this answer

















    • 3




      Did you REALLY put all those into the intent that you pass to startListening?? Did it really work? And didn't it with EXTRA_LANGUAGE alone? What Android versions did you test? EXTRA_LANGUAGE is the only one that is supposed to be relevant here. The other two, according to documentation, are meant for querying the system for supported language, NOT for recognition. So they should be totally meaningless here. For me, it works with EXTRA_LANGUAGE alone until 4.3, then the extra is completely ignored starting from 4.4.
      – matteo
      Sep 5 '14 at 16:42






    • 1




      @matteo right...not working on 4.4...
      – Arnav M.
      Nov 1 '14 at 10:31


















    up vote
    1
    down vote













    I tried to use



    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());


    but it did not work for me (did not take the system language).
    Helped here like this:



    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault().toString());





    share|improve this answer




























      up vote
      0
      down vote













      this code is to set the language in speech recognization



        String languagePref = "te-IN";//this is for telugu

      //kannada ---> "kn-IN"
      //tamil---> "ta-IN".....

      Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
      RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);





      share|improve this answer




























        up vote
        -1
        down vote













        I used this code:



        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");


        Hope you can run your app now.






        share|improve this answer























          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10538791%2fhow-to-set-the-language-in-speech-recognition-on-android%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          8 Answers
          8






          active

          oldest

          votes








          8 Answers
          8






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          43
          down vote



          accepted










          As pargat says, this will do it:



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


          Also, your app can query for the list of supported languages by sending a RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS ordered broadcast like so:



              Intent detailsIntent =  new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
          sendOrderedBroadcast(
          detailsIntent, null, new LanguageDetailsChecker(), null, Activity.RESULT_OK, null, null);


          where LanguageDetailsChecker is something like this:



          public class LanguageDetailsChecker extends BroadcastReceiver
          {
          private List<String> supportedLanguages;

          private String languagePreference;

          @Override
          public void onReceive(Context context, Intent intent)
          {
          Bundle results = getResultExtras(true);
          if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE))
          {
          languagePreference =
          results.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE);
          }
          if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES))
          {
          supportedLanguages =
          results.getStringArrayList(
          RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);
          }
          }
          }


          For the complete code check out this github project:
          https://github.com/gast-lib






          share|improve this answer























          • Thanks for the full package
            – Mr.Me
            May 12 '12 at 18:42






          • 2




            I think it easier to use RecognizerIntent method for creating the intent: ` val detailsIntent = RecognizerIntent.getVoiceDetailsIntent(context) activity.sendOrderedBroadcast(detailsIntent, null, LanguageDetailsChecker({ languages.accept(it) }), null, Activity.RESULT_OK, null, null)` Intent from the sample above didn't work for me :( getVoiceDetailsIntent() did :)
            – Aetherna
            Nov 20 '17 at 15:04












          • Putting "en-US" doesn't work for me. Use intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString()); as suggested in the answer by @orina1123
            – M3RS
            Jul 16 at 13:20

















          up vote
          43
          down vote



          accepted










          As pargat says, this will do it:



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


          Also, your app can query for the list of supported languages by sending a RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS ordered broadcast like so:



              Intent detailsIntent =  new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
          sendOrderedBroadcast(
          detailsIntent, null, new LanguageDetailsChecker(), null, Activity.RESULT_OK, null, null);


          where LanguageDetailsChecker is something like this:



          public class LanguageDetailsChecker extends BroadcastReceiver
          {
          private List<String> supportedLanguages;

          private String languagePreference;

          @Override
          public void onReceive(Context context, Intent intent)
          {
          Bundle results = getResultExtras(true);
          if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE))
          {
          languagePreference =
          results.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE);
          }
          if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES))
          {
          supportedLanguages =
          results.getStringArrayList(
          RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);
          }
          }
          }


          For the complete code check out this github project:
          https://github.com/gast-lib






          share|improve this answer























          • Thanks for the full package
            – Mr.Me
            May 12 '12 at 18:42






          • 2




            I think it easier to use RecognizerIntent method for creating the intent: ` val detailsIntent = RecognizerIntent.getVoiceDetailsIntent(context) activity.sendOrderedBroadcast(detailsIntent, null, LanguageDetailsChecker({ languages.accept(it) }), null, Activity.RESULT_OK, null, null)` Intent from the sample above didn't work for me :( getVoiceDetailsIntent() did :)
            – Aetherna
            Nov 20 '17 at 15:04












          • Putting "en-US" doesn't work for me. Use intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString()); as suggested in the answer by @orina1123
            – M3RS
            Jul 16 at 13:20















          up vote
          43
          down vote



          accepted







          up vote
          43
          down vote



          accepted






          As pargat says, this will do it:



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


          Also, your app can query for the list of supported languages by sending a RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS ordered broadcast like so:



              Intent detailsIntent =  new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
          sendOrderedBroadcast(
          detailsIntent, null, new LanguageDetailsChecker(), null, Activity.RESULT_OK, null, null);


          where LanguageDetailsChecker is something like this:



          public class LanguageDetailsChecker extends BroadcastReceiver
          {
          private List<String> supportedLanguages;

          private String languagePreference;

          @Override
          public void onReceive(Context context, Intent intent)
          {
          Bundle results = getResultExtras(true);
          if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE))
          {
          languagePreference =
          results.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE);
          }
          if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES))
          {
          supportedLanguages =
          results.getStringArrayList(
          RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);
          }
          }
          }


          For the complete code check out this github project:
          https://github.com/gast-lib






          share|improve this answer














          As pargat says, this will do it:



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


          Also, your app can query for the list of supported languages by sending a RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS ordered broadcast like so:



              Intent detailsIntent =  new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
          sendOrderedBroadcast(
          detailsIntent, null, new LanguageDetailsChecker(), null, Activity.RESULT_OK, null, null);


          where LanguageDetailsChecker is something like this:



          public class LanguageDetailsChecker extends BroadcastReceiver
          {
          private List<String> supportedLanguages;

          private String languagePreference;

          @Override
          public void onReceive(Context context, Intent intent)
          {
          Bundle results = getResultExtras(true);
          if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE))
          {
          languagePreference =
          results.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE);
          }
          if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES))
          {
          supportedLanguages =
          results.getStringArrayList(
          RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES);
          }
          }
          }


          For the complete code check out this github project:
          https://github.com/gast-lib







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 12 '14 at 16:32









          Confuse

          3,04442550




          3,04442550










          answered May 11 '12 at 9:17









          gregm

          8,29544868




          8,29544868












          • Thanks for the full package
            – Mr.Me
            May 12 '12 at 18:42






          • 2




            I think it easier to use RecognizerIntent method for creating the intent: ` val detailsIntent = RecognizerIntent.getVoiceDetailsIntent(context) activity.sendOrderedBroadcast(detailsIntent, null, LanguageDetailsChecker({ languages.accept(it) }), null, Activity.RESULT_OK, null, null)` Intent from the sample above didn't work for me :( getVoiceDetailsIntent() did :)
            – Aetherna
            Nov 20 '17 at 15:04












          • Putting "en-US" doesn't work for me. Use intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString()); as suggested in the answer by @orina1123
            – M3RS
            Jul 16 at 13:20




















          • Thanks for the full package
            – Mr.Me
            May 12 '12 at 18:42






          • 2




            I think it easier to use RecognizerIntent method for creating the intent: ` val detailsIntent = RecognizerIntent.getVoiceDetailsIntent(context) activity.sendOrderedBroadcast(detailsIntent, null, LanguageDetailsChecker({ languages.accept(it) }), null, Activity.RESULT_OK, null, null)` Intent from the sample above didn't work for me :( getVoiceDetailsIntent() did :)
            – Aetherna
            Nov 20 '17 at 15:04












          • Putting "en-US" doesn't work for me. Use intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString()); as suggested in the answer by @orina1123
            – M3RS
            Jul 16 at 13:20


















          Thanks for the full package
          – Mr.Me
          May 12 '12 at 18:42




          Thanks for the full package
          – Mr.Me
          May 12 '12 at 18:42




          2




          2




          I think it easier to use RecognizerIntent method for creating the intent: ` val detailsIntent = RecognizerIntent.getVoiceDetailsIntent(context) activity.sendOrderedBroadcast(detailsIntent, null, LanguageDetailsChecker({ languages.accept(it) }), null, Activity.RESULT_OK, null, null)` Intent from the sample above didn't work for me :( getVoiceDetailsIntent() did :)
          – Aetherna
          Nov 20 '17 at 15:04






          I think it easier to use RecognizerIntent method for creating the intent: ` val detailsIntent = RecognizerIntent.getVoiceDetailsIntent(context) activity.sendOrderedBroadcast(detailsIntent, null, LanguageDetailsChecker({ languages.accept(it) }), null, Activity.RESULT_OK, null, null)` Intent from the sample above didn't work for me :( getVoiceDetailsIntent() did :)
          – Aetherna
          Nov 20 '17 at 15:04














          Putting "en-US" doesn't work for me. Use intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString()); as suggested in the answer by @orina1123
          – M3RS
          Jul 16 at 13:20






          Putting "en-US" doesn't work for me. Use intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString()); as suggested in the answer by @orina1123
          – M3RS
          Jul 16 at 13:20














          up vote
          12
          down vote













          there is no solution but a hackaround...



          intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String{"en"});


          check here the complete story.






          share|improve this answer

















          • 2




            Dude I don't know why you had only 1 point but this is definitely a correct answer. Thanks a lot.
            – TacB0sS
            Dec 14 '14 at 15:11






          • 1




            @TacB0sS people like long answers...well i am glad it helped you.
            – Arnav M.
            Dec 15 '14 at 4:18






          • 1




            most useful answer i ever get ! really.
            – Behnam Esmaili
            Dec 12 '16 at 10:20















          up vote
          12
          down vote













          there is no solution but a hackaround...



          intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String{"en"});


          check here the complete story.






          share|improve this answer

















          • 2




            Dude I don't know why you had only 1 point but this is definitely a correct answer. Thanks a lot.
            – TacB0sS
            Dec 14 '14 at 15:11






          • 1




            @TacB0sS people like long answers...well i am glad it helped you.
            – Arnav M.
            Dec 15 '14 at 4:18






          • 1




            most useful answer i ever get ! really.
            – Behnam Esmaili
            Dec 12 '16 at 10:20













          up vote
          12
          down vote










          up vote
          12
          down vote









          there is no solution but a hackaround...



          intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String{"en"});


          check here the complete story.






          share|improve this answer












          there is no solution but a hackaround...



          intent.putExtra("android.speech.extra.EXTRA_ADDITIONAL_LANGUAGES", new String{"en"});


          check here the complete story.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 1 '14 at 10:48









          Arnav M.

          1,90611835




          1,90611835








          • 2




            Dude I don't know why you had only 1 point but this is definitely a correct answer. Thanks a lot.
            – TacB0sS
            Dec 14 '14 at 15:11






          • 1




            @TacB0sS people like long answers...well i am glad it helped you.
            – Arnav M.
            Dec 15 '14 at 4:18






          • 1




            most useful answer i ever get ! really.
            – Behnam Esmaili
            Dec 12 '16 at 10:20














          • 2




            Dude I don't know why you had only 1 point but this is definitely a correct answer. Thanks a lot.
            – TacB0sS
            Dec 14 '14 at 15:11






          • 1




            @TacB0sS people like long answers...well i am glad it helped you.
            – Arnav M.
            Dec 15 '14 at 4:18






          • 1




            most useful answer i ever get ! really.
            – Behnam Esmaili
            Dec 12 '16 at 10:20








          2




          2




          Dude I don't know why you had only 1 point but this is definitely a correct answer. Thanks a lot.
          – TacB0sS
          Dec 14 '14 at 15:11




          Dude I don't know why you had only 1 point but this is definitely a correct answer. Thanks a lot.
          – TacB0sS
          Dec 14 '14 at 15:11




          1




          1




          @TacB0sS people like long answers...well i am glad it helped you.
          – Arnav M.
          Dec 15 '14 at 4:18




          @TacB0sS people like long answers...well i am glad it helped you.
          – Arnav M.
          Dec 15 '14 at 4:18




          1




          1




          most useful answer i ever get ! really.
          – Behnam Esmaili
          Dec 12 '16 at 10:20




          most useful answer i ever get ! really.
          – Behnam Esmaili
          Dec 12 '16 at 10:20










          up vote
          9
          down vote













          This will work:



          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en_US");


          You have to use "en_US" instead of "en-US". The former is the right format of Java locale tag.



          It is suggested that you use



          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString());


          to avoid remembering such detail.






          share|improve this answer





















          • Thanks, man. This saved hours of the time of mine!!! The problem was similar but little difference. Can find it here stackoverflow.com/questions/51048466/…
            – Varun A M
            Jun 27 at 7:05

















          up vote
          9
          down vote













          This will work:



          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en_US");


          You have to use "en_US" instead of "en-US". The former is the right format of Java locale tag.



          It is suggested that you use



          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString());


          to avoid remembering such detail.






          share|improve this answer





















          • Thanks, man. This saved hours of the time of mine!!! The problem was similar but little difference. Can find it here stackoverflow.com/questions/51048466/…
            – Varun A M
            Jun 27 at 7:05















          up vote
          9
          down vote










          up vote
          9
          down vote









          This will work:



          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en_US");


          You have to use "en_US" instead of "en-US". The former is the right format of Java locale tag.



          It is suggested that you use



          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString());


          to avoid remembering such detail.






          share|improve this answer












          This will work:



          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en_US");


          You have to use "en_US" instead of "en-US". The former is the right format of Java locale tag.



          It is suggested that you use



          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.US.toString());


          to avoid remembering such detail.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 16 '13 at 9:49









          orina1123

          9111




          9111












          • Thanks, man. This saved hours of the time of mine!!! The problem was similar but little difference. Can find it here stackoverflow.com/questions/51048466/…
            – Varun A M
            Jun 27 at 7:05




















          • Thanks, man. This saved hours of the time of mine!!! The problem was similar but little difference. Can find it here stackoverflow.com/questions/51048466/…
            – Varun A M
            Jun 27 at 7:05


















          Thanks, man. This saved hours of the time of mine!!! The problem was similar but little difference. Can find it here stackoverflow.com/questions/51048466/…
          – Varun A M
          Jun 27 at 7:05






          Thanks, man. This saved hours of the time of mine!!! The problem was similar but little difference. Can find it here stackoverflow.com/questions/51048466/…
          – Varun A M
          Jun 27 at 7:05












          up vote
          8
          down vote













          Have you tried this:



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





          share|improve this answer

























            up vote
            8
            down vote













            Have you tried this:



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





            share|improve this answer























              up vote
              8
              down vote










              up vote
              8
              down vote









              Have you tried this:



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





              share|improve this answer












              Have you tried this:



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






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered May 10 '12 at 17:45









              Pargat

              574720




              574720






















                  up vote
                  6
                  down vote













                  I finally got my app to restrict voice recognition results to a specified language input (handing it, e.g., "ja" for Japanese or "fr" for French) by adding all 3 of the following extras:



                  String languagePref = "de";//or, whatever iso code...
                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);
                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, languagePref);
                  intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, languagePref);


                  Hope this helps someone.






                  share|improve this answer

















                  • 3




                    Did you REALLY put all those into the intent that you pass to startListening?? Did it really work? And didn't it with EXTRA_LANGUAGE alone? What Android versions did you test? EXTRA_LANGUAGE is the only one that is supposed to be relevant here. The other two, according to documentation, are meant for querying the system for supported language, NOT for recognition. So they should be totally meaningless here. For me, it works with EXTRA_LANGUAGE alone until 4.3, then the extra is completely ignored starting from 4.4.
                    – matteo
                    Sep 5 '14 at 16:42






                  • 1




                    @matteo right...not working on 4.4...
                    – Arnav M.
                    Nov 1 '14 at 10:31















                  up vote
                  6
                  down vote













                  I finally got my app to restrict voice recognition results to a specified language input (handing it, e.g., "ja" for Japanese or "fr" for French) by adding all 3 of the following extras:



                  String languagePref = "de";//or, whatever iso code...
                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);
                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, languagePref);
                  intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, languagePref);


                  Hope this helps someone.






                  share|improve this answer

















                  • 3




                    Did you REALLY put all those into the intent that you pass to startListening?? Did it really work? And didn't it with EXTRA_LANGUAGE alone? What Android versions did you test? EXTRA_LANGUAGE is the only one that is supposed to be relevant here. The other two, according to documentation, are meant for querying the system for supported language, NOT for recognition. So they should be totally meaningless here. For me, it works with EXTRA_LANGUAGE alone until 4.3, then the extra is completely ignored starting from 4.4.
                    – matteo
                    Sep 5 '14 at 16:42






                  • 1




                    @matteo right...not working on 4.4...
                    – Arnav M.
                    Nov 1 '14 at 10:31













                  up vote
                  6
                  down vote










                  up vote
                  6
                  down vote









                  I finally got my app to restrict voice recognition results to a specified language input (handing it, e.g., "ja" for Japanese or "fr" for French) by adding all 3 of the following extras:



                  String languagePref = "de";//or, whatever iso code...
                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);
                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, languagePref);
                  intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, languagePref);


                  Hope this helps someone.






                  share|improve this answer












                  I finally got my app to restrict voice recognition results to a specified language input (handing it, e.g., "ja" for Japanese or "fr" for French) by adding all 3 of the following extras:



                  String languagePref = "de";//or, whatever iso code...
                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);
                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, languagePref);
                  intent.putExtra(RecognizerIntent.EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE, languagePref);


                  Hope this helps someone.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 21 '13 at 4:25









                  kwishnu

                  1,2961215




                  1,2961215








                  • 3




                    Did you REALLY put all those into the intent that you pass to startListening?? Did it really work? And didn't it with EXTRA_LANGUAGE alone? What Android versions did you test? EXTRA_LANGUAGE is the only one that is supposed to be relevant here. The other two, according to documentation, are meant for querying the system for supported language, NOT for recognition. So they should be totally meaningless here. For me, it works with EXTRA_LANGUAGE alone until 4.3, then the extra is completely ignored starting from 4.4.
                    – matteo
                    Sep 5 '14 at 16:42






                  • 1




                    @matteo right...not working on 4.4...
                    – Arnav M.
                    Nov 1 '14 at 10:31














                  • 3




                    Did you REALLY put all those into the intent that you pass to startListening?? Did it really work? And didn't it with EXTRA_LANGUAGE alone? What Android versions did you test? EXTRA_LANGUAGE is the only one that is supposed to be relevant here. The other two, according to documentation, are meant for querying the system for supported language, NOT for recognition. So they should be totally meaningless here. For me, it works with EXTRA_LANGUAGE alone until 4.3, then the extra is completely ignored starting from 4.4.
                    – matteo
                    Sep 5 '14 at 16:42






                  • 1




                    @matteo right...not working on 4.4...
                    – Arnav M.
                    Nov 1 '14 at 10:31








                  3




                  3




                  Did you REALLY put all those into the intent that you pass to startListening?? Did it really work? And didn't it with EXTRA_LANGUAGE alone? What Android versions did you test? EXTRA_LANGUAGE is the only one that is supposed to be relevant here. The other two, according to documentation, are meant for querying the system for supported language, NOT for recognition. So they should be totally meaningless here. For me, it works with EXTRA_LANGUAGE alone until 4.3, then the extra is completely ignored starting from 4.4.
                  – matteo
                  Sep 5 '14 at 16:42




                  Did you REALLY put all those into the intent that you pass to startListening?? Did it really work? And didn't it with EXTRA_LANGUAGE alone? What Android versions did you test? EXTRA_LANGUAGE is the only one that is supposed to be relevant here. The other two, according to documentation, are meant for querying the system for supported language, NOT for recognition. So they should be totally meaningless here. For me, it works with EXTRA_LANGUAGE alone until 4.3, then the extra is completely ignored starting from 4.4.
                  – matteo
                  Sep 5 '14 at 16:42




                  1




                  1




                  @matteo right...not working on 4.4...
                  – Arnav M.
                  Nov 1 '14 at 10:31




                  @matteo right...not working on 4.4...
                  – Arnav M.
                  Nov 1 '14 at 10:31










                  up vote
                  1
                  down vote













                  I tried to use



                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());


                  but it did not work for me (did not take the system language).
                  Helped here like this:



                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault().toString());





                  share|improve this answer

























                    up vote
                    1
                    down vote













                    I tried to use



                    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());


                    but it did not work for me (did not take the system language).
                    Helped here like this:



                    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault().toString());





                    share|improve this answer























                      up vote
                      1
                      down vote










                      up vote
                      1
                      down vote









                      I tried to use



                      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());


                      but it did not work for me (did not take the system language).
                      Helped here like this:



                      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault().toString());





                      share|improve this answer












                      I tried to use



                      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());


                      but it did not work for me (did not take the system language).
                      Helped here like this:



                      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault().toString());






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 8 '17 at 19:18









                      Oleg SH

                      19916




                      19916






















                          up vote
                          0
                          down vote













                          this code is to set the language in speech recognization



                            String languagePref = "te-IN";//this is for telugu

                          //kannada ---> "kn-IN"
                          //tamil---> "ta-IN".....

                          Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
                          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                          RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
                          intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);





                          share|improve this answer

























                            up vote
                            0
                            down vote













                            this code is to set the language in speech recognization



                              String languagePref = "te-IN";//this is for telugu

                            //kannada ---> "kn-IN"
                            //tamil---> "ta-IN".....

                            Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
                            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
                            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);





                            share|improve this answer























                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              this code is to set the language in speech recognization



                                String languagePref = "te-IN";//this is for telugu

                              //kannada ---> "kn-IN"
                              //tamil---> "ta-IN".....

                              Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
                              intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                              RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
                              intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);





                              share|improve this answer












                              this code is to set the language in speech recognization



                                String languagePref = "te-IN";//this is for telugu

                              //kannada ---> "kn-IN"
                              //tamil---> "ta-IN".....

                              Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
                              intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                              RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
                              intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, languagePref);






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Sep 29 at 10:36









                              dileep krishnan

                              1175




                              1175






















                                  up vote
                                  -1
                                  down vote













                                  I used this code:



                                  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");


                                  Hope you can run your app now.






                                  share|improve this answer



























                                    up vote
                                    -1
                                    down vote













                                    I used this code:



                                    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");


                                    Hope you can run your app now.






                                    share|improve this answer

























                                      up vote
                                      -1
                                      down vote










                                      up vote
                                      -1
                                      down vote









                                      I used this code:



                                      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");


                                      Hope you can run your app now.






                                      share|improve this answer














                                      I used this code:



                                      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");


                                      Hope you can run your app now.







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Aug 28 '15 at 19:14









                                      user5173426

                                      3,58621034




                                      3,58621034










                                      answered Aug 28 '15 at 18:15









                                      user5278060

                                      1




                                      1






























                                           

                                          draft saved


                                          draft discarded



















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10538791%2fhow-to-set-the-language-in-speech-recognition-on-android%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest




















































































                                          Popular posts from this blog

                                          鏡平學校

                                          ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

                                          Why https connections are so slow when debugging (stepping over) in Java?