Example usage for android.speech RecognizerIntent ACTION_GET_LANGUAGE_DETAILS

List of usage examples for android.speech RecognizerIntent ACTION_GET_LANGUAGE_DETAILS

Introduction

In this page you can find the example usage for android.speech RecognizerIntent ACTION_GET_LANGUAGE_DETAILS.

Prototype

String ACTION_GET_LANGUAGE_DETAILS

To view the source code for android.speech RecognizerIntent ACTION_GET_LANGUAGE_DETAILS.

Click Source Link

Document

A broadcast intent which can be fired to the BroadcastReceiver component specified in the meta-data defined in the #DETAILS_META_DATA meta-data of an Activity satisfying #ACTION_WEB_SEARCH .

Usage

From source file:com.corumgaz.mobilsayac.VoiceRecognizer.VoiceRecognizer.java

private void getSupportedLanguages() {
    if (languageDetailsChecker == null) {
        languageDetailsChecker = new LanguageDetailsChecker(callbackContext);
    }//w w w.  ja v a2s  .c  o  m
    // Create and launch get languages intent
    Intent detailsIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
    cordova.getActivity().sendOrderedBroadcast(detailsIntent, null, languageDetailsChecker, null,
            Activity.RESULT_OK, null, null);

}

From source file:com.ksutopia.bbtalks.plugins.P201SpeechToText.java

private void getSupportedLanguages() {
    if (languageDetailsChecker == null) {
        languageDetailsChecker = new P202LanguageDetailsChecker(callbackContext);
    }//  ww  w . j ava2 s  .com
    // Create and launch get languages intent
    Intent detailsIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
    cordova.getActivity().sendOrderedBroadcast(detailsIntent, null, languageDetailsChecker, null,
            Activity.RESULT_OK, null, null);

}

From source file:com.phonegap.plugins.speech.SpeechToText.java

private void getSupportedLanguages2() {
    if (languageDetailsChecker == null) {
        languageDetailsChecker = new LanguageDetailsChecker(callbackContext);
    }// w  w  w .  j a v a 2s .  com
    // Create and launch get languages intent
    Intent detailsIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
    cordova.getActivity().sendOrderedBroadcast(detailsIntent, null, languageDetailsChecker, null,
            Activity.RESULT_OK, null, null);

}

From source file:com.ct.speech.HintReceiver.java

/**
 * Request the supported languages/*from w w  w  .j  a  v  a  2  s.co  m*/
 */
private void getSupportedLanguages() {
    // Create and launch get languages intent
    Intent intent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
    HintReceiver hintReceiver = new HintReceiver();
    hintReceiver.setSpeechRecognizer(this);
    // hintReceiver.setCallBackId(this.callbackId);
    ctx.getApplicationContext().sendOrderedBroadcast(intent, null, hintReceiver, null, Activity.RESULT_OK, null,
            null);
}

From source file:de.dfki.iui.mmir.plugins.speech.android.AndroidSpeechRecognizer.java

private void getSupportedLanguages(CallbackContext callbackContext) {

    if (languageDetailsChecker == null) {
        languageDetailsChecker = new LanguageDetailsReceiver(callbackContext);
    } else {//from w ww  .  j  a  va  2 s  .  c o m
        languageDetailsChecker.setCallbackContext(callbackContext);
    }

    // Create and launch get languages intent
    Intent detailsIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
    cordova.getActivity().sendOrderedBroadcast(detailsIntent, null, languageDetailsChecker, null,
            Activity.RESULT_OK, null, null);
}

From source file:com.phonegap.plugins.speech.XSpeechRecognizer.java

private void getSupportedLanguages() {
    if (languageDetailsChecker == null) {
        languageDetailsChecker = new LanguageDetailsChecker(callbackContext);
    }/* w w  w. jav a  2  s  . c  o  m*/
    Intent detailsIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
    cordova.getActivity().sendOrderedBroadcast(detailsIntent, null, languageDetailsChecker, null,
            Activity.RESULT_OK, null, null);
}

From source file:root.gast.playground.speech.SpeechRecognitionPlay.java

public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == R.id.m_speechparam) {
        //launch preferences activity
        Intent i = new Intent(this, SummarizingEditPreferences.class);
        i.putExtra(SummarizingEditPreferences.WHICH_PREFERENCES_INTENT, R.xml.speech_preferences);
        String preferenceName = getResources().getString(R.string.pref_speech_key);
        i.putExtra(SummarizingEditPreferences.WHICH_PREFERENCES_NAME_INTENT, preferenceName);
        startActivity(i);/*from   w  ww.j av a 2 s  .c  om*/
    } else if (item.getItemId() == R.id.m_speech_language_details) {
        OnLanguageDetailsListener andThen = new OnLanguageDetailsListener() {
            @Override
            public void onLanguageDetailsReceived(LanguageDetailsChecker data) {
                String languagesSupportedDescription = data.toString();
                DialogGenerator.createInfoDialog(SpeechRecognitionPlay.this,
                        getResources().getString(R.string.speech_data_check_result_title),
                        languagesSupportedDescription).show();
            }
        };
        Intent detailsIntent = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
        sendOrderedBroadcast(detailsIntent, null, new LanguageDetailsChecker(andThen), null, Activity.RESULT_OK,
                null, null);
    } else if (item.getItemId() == R.id.m_setlanguage) {
        OnLanguageDetailsListener andThenSetLanguage = new OnLanguageDetailsListener() {
            @Override
            public void onLanguageDetailsReceived(LanguageDetailsChecker data) {
                final List<String> langs = data.getSupportedLanguages();
                DialogGenerator.makeSelectListDialog(getResources().getString(R.string.d_select_language),
                        SpeechRecognitionPlay.this, langs, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                String setLanguagePreferenceTo = langs.get(which);
                                preferences.setString(getResources().getString(R.string.pref_language),
                                        setLanguagePreferenceTo);
                            }
                        }).show();
            }
        };
        Intent details = new Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS);
        sendOrderedBroadcast(details, null, new LanguageDetailsChecker(andThenSetLanguage), null,
                Activity.RESULT_OK, null, null);
    } else if (item.getItemId() == R.id.m_checkmenu_languageavailable) {
        //show all the locales, and pic one to check
        final List<Locale> localesUsed = Arrays.asList(Locale.getAvailableLocales());
        DialogGenerator.makeSelectListDialog(getResources().getString(R.string.d_select_language), this,
                localesUsed, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Locale loc = localesUsed.get(which);
                        Toast.makeText(SpeechRecognitionPlay.this, "Checking language support for: " + loc,
                                Toast.LENGTH_SHORT).show();
                        checkForLanguage(loc);
                    }
                }).show();
    } else if (item.getItemId() == R.id.m_speech_compute_index) {
        final View frameLayout = getLayoutInflater().inflate(R.layout.enterworddialog, null);
        final EditText dialogtext = (EditText) frameLayout.findViewById(R.id.et_dialog_text_input);
        String hint = whatYouAreTryingToSay.getText().toString();
        if ((hint != null) && (hint.length() > 0)) {
            hint = hint.split("\\s")[0];
        }
        dialogtext.setText(hint);
        //reply with the word's index
        //show an edit box
        DialogGenerator.createFrameDialog(this, "Enter word to index", frameLayout,
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        String input = dialogtext.getText().toString();
                        String soundex = new Soundex().encode(input);
                        String stem = Stemmer.stem(input);
                        StringBuilder message = new StringBuilder();
                        message.append("input: ").append(input).append("\n");
                        message.append("soundex: ").append(soundex).append("\n");
                        message.append("stem: ").append(stem);
                        DialogGenerator.createInfoDialog(SpeechRecognitionPlay.this,
                                getResources().getString(R.string.d_info), message.toString()).show();
                    }
                }).show();
    } else if (item.getItemId() == R.id.m_write_speech_activation_tag) {
        Log.d(TAG, "start write activation");
        Intent doTag = new Intent(this, SpeechActivatorTagWriter.class);
        startActivity(doTag);
    } else {
        throw new RuntimeException("unknown menu selection");
    }
    return true;
}