Android, SpeechRecognizer: no selected voice recognition service
<p>I want to create simple Speech to Text application and I have found <code>SpeechRecognizer</code> class, which looks like something that I need.</p>

<p>I have added these permissions to my manifest:</p>

<pre><code>&lt;uses-permission android:name="android.permission.RECORD_AUDIO"/&gt;
&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
</code></pre>

<p>Then in my <code>MainActivity</code> there is only one <code>button</code> and one <code>textVew</code>.
I have set my activity's <code>onCreate</code> like this:</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    textView = (TextView) findViewById(R.id.textView);
    button = (Button) findViewById(R.id.button);

    sr = SpeechRecognizer.createSpeechRecognizer(this);
    sr.setRecognitionListener(new MySpeechRecognitionListener());

    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
            intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
            intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 10);
            intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,"com.daniyar.speechrecogniitontest");
            sr.startListening(intent);
        }
    });
}
</code></pre>

<p>And In my <code>MySpeechRecognitionListener</code> looks like this:</p>

<pre><code>private class MySpeechRecognitionListener implements RecognitionListener {
    @Override
    public void onReadyForSpeech(Bundle bundle) {
        Toast.makeText(MainActivity.this, "Ready", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onError(int i) {
        Toast.makeText(MainActivity.this, "Error " + i, Toast.LENGTH_LONG).show();
    }

  @Override
    public void onResults(Bundle bundle) {
        String str = "";
        ArrayList data = bundle.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
        for (int i = 0 ; i &lt; data.size(); i++) {
            str += data.get(i);
        }

        textView.setText(str);
    }
}
</code></pre>

<p>When I launch my application and then click to button it shows me toast with <code>Error 5</code> and in my logs, there is a message:</p>

<pre><code>SpeechRecognizer: no selected voice recognition service
</code></pre>

<p>How to set recognition service? Also, is it possible to use SpeechRecognizer offline?</p>