Note that there are some explanatory texts on larger screens.

plurals
  1. POcom.google.android.voicesearch.speechservice.ConnectionException: Failed to establish connection
    primarykey
    data
    text
    <p>I am testing an app that makes voice recognition, but now I am getting this error:</p> <pre><code>11-04 16:25:58.249: E/ServerConnectorImpl(13716): Failed to create TCP connection 11-04 16:25:58.249: E/ServerConnectorImpl(13716): com.google.android.voicesearch.speechservice.ConnectionException: Failed to establish connection 11-04 16:25:58.249: E/ServerConnectorImpl(13716): at com.google.android.voicesearch.tcp.TcpConnectionImpl.&lt;init&gt;(TcpConnectionImpl.java:87) .... </code></pre> <p>Here is my code:</p> <pre><code>sr = SpeechRecognizer.createSpeechRecognizer(getApplicationContext()); MyRecognition listener = new MyRecognition(); sr.setRecognitionListener(listener); </code></pre> <p>Class MyRecognition that implements the methods from RecognitionListener</p> <pre><code>class MyRecognition implements RecognitionListener{ public void onBeginningOfSpeech() { } public void onBufferReceived(byte[] buffer) { } public void onEndOfSpeech() { } public void onError(int error) { MediaPlayer mp = new MediaPlayer(); AssetFileDescriptor asset; try { asset = getAssets().openFd("error.mp3"); mp.setDataSource(asset.getFileDescriptor(), asset.getStartOffset(), asset.getLength()); asset.close(); mp.prepare(); mp.start(); mp.setOnCompletionListener(AddActivity.this); } catch (IOException e) { e.printStackTrace(); } } .... public void onResults(Bundle results) { .... } .... } </code></pre> <p>The method that makes the voice recognition</p> <pre><code>private void reconheceVoz(final MediaPlayer mp){ try{ Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, "com.br.test"); intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 5); sr.startListening(intent); mp.release(); } catch(Exception e){ Toast.makeText(AdicaoActivity.this, "Erro: " + e.getMessage(), Toast.LENGTH_SHORT).show(); } } </code></pre> <p>This error occurs often? How can I treat it?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload