Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy did RecognitionListener stop working in JellyBean?
    text
    copied!<p>For everyone using Android's <a href="http://developer.android.com/reference/android/speech/RecognizerIntent.html">voice recognition API</a>, there used to be a handy <a href="http://developer.android.com/reference/android/speech/RecognitionListener.html#onBufferReceived%28byte%5B%5D%29">RecognitionListener</a> you could register that would push various events to your callbacks. In particular, there was the following <a href="http://developer.android.com/reference/android/speech/RecognitionListener.html#onBufferReceived%28byte%5B%5D%29"><code>onBufferReceived(byte[])</code></a> method:</p> <blockquote> <p><code>public abstract void onBufferReceived (byte[] buffer)</code></p> <p><em>Since: API Level 8</em> More sound has been received. The purpose of this function is to allow giving feedback to the user regarding the captured audio. There is no guarantee that this method will be called.</p> <p><strong>Parameters</strong> <code>buffer</code> a buffer containing a sequence of big-endian 16-bit integers representing a single channel audio stream. The sample rate is implementation dependent.</p> </blockquote> <p>Although the method explicitly states that there is no <em>guarantee</em> it will be called, in ICS and prior it would effectively be called 100% of the time: regularly enough, at least, that by concatenating all the bytes received this way, you could reconstruct the entire audio stream and play it back.</p> <p>For some reason, however, in the Jellybean SDK, <strong>this magically stopped working</strong>. There's no notice of deprecation and the code still compiles, but the <code>onBufferReceived</code> is now <strong>never</strong> called. Technically this isn't breaking their API (since it says there's "no guarantee" the method will be called), but clearly this is a breaking change for a lot of things that depended on this behaviour.</p> <p>Does anybody know why this functionality was disabled, and if there's a way to replicate its behaviour on Jellybean?</p> <p><strong>Clarification</strong>: I realize that the whole <code>RecognizerIntent</code> thing is an interface with multiple implementations (including some available on the Play Store), and that they can each choose what to do with <code>RecognitionListener</code>. I am specifically referring to the default Google implementation that the vast majority of Jellybean phones use.</p>
 

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