public boolean voiceSearchEnabled() { 
        return mSearchable.getVoiceSearchEnabled();
    public Intent createVoiceSearchIntent(Bundle appData) {
        if (mSearchable.getVoiceSearchLaunchWebSearch()) {
            return createVoiceWebSearchIntent(appData);
        } else if (mSearchable.getVoiceSearchLaunchRecognizer()) {
            return createVoiceAppSearchIntent(appData);
        return null; 
     * Create and return an Intent that can launch the voice search activity, perform a specific 
     * voice transcription, and forward the results to the searchable activity. 
     * This code is copied from SearchDialog 
     * @return A completely-configured intent ready to send to the voice search activity 
    private Intent createVoiceAppSearchIntent(Bundle appData) {
        ComponentName searchActivity = mSearchable.getSearchActivity();
        // create the necessary intent to set up a search-and-forward operation 
        // in the voice search system.   We have to keep the bundle separate, 
        // because it becomes immutable once it enters the PendingIntent 
        Intent queryIntent = new Intent(Intent.ACTION_SEARCH);
        PendingIntent pending = PendingIntent.getActivity(
                getContext(), 0, queryIntent, PendingIntent.FLAG_ONE_SHOT);
        // Now set up the bundle that will be inserted into the pending intent 
        // when it's time to do the search.  We always build it here (even if empty) 
        // because the voice search activity will always need to insert "QUERY" into 
        // it anyway. 
        Bundle queryExtras = new Bundle();
        if (appData != null) {
            queryExtras.putBundle(SearchManager.APP_DATA, appData);
        // Now build the intent to launch the voice search.  Add all necessary 
        // extras to launch the voice recognizer, and then all the necessary extras 
        // to forward the results to the searchable activity 
        Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        // Add all of the configuration options supplied by the searchable's metadata 
        String languageModel = getString(mSearchable.getVoiceLanguageModeId());
        if (languageModel == null) {
            languageModel = RecognizerIntent.LANGUAGE_MODEL_FREE_FORM;
        String prompt = getString(mSearchable.getVoicePromptTextId());
        String language = getString(mSearchable.getVoiceLanguageId());
        int maxResults = mSearchable.getVoiceMaxResults();
        if (maxResults <= 0) {
            maxResults = 1;
        voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, languageModel);