Why did RecognitionListener stop working in JellyBean?

前端 未结 4 1140
清酒与你
清酒与你 2021-02-01 08:07

For everyone using Android\'s voice recognition API, there used to be a handy RecognitionListener you could register that would push various events to your callbacks. In particu

4条回答
  •  醉梦人生
    2021-02-01 08:39

    I ran in to the same problem. The reason why I didn't just accept that "this does not work" was because Google Nows "note-to-self" record the audio and sends it to you. What I found out in logcat while running the "note-to-self"-operation was:

    02-20 14:04:59.664: I/AudioService(525):  AudioFocus  requestAudioFocus() from android.media.AudioManager@42439ca8com.google.android.voicesearch.audio.ByteArrayPlayer$1@424cca50
    
    02-20 14:04:59.754: I/AbstractCardController.SelfNoteController(8675): #attach
    02-20 14:05:01.006: I/AudioService(525):  AudioFocus  abandonAudioFocus() from android.media.AudioManager@42439ca8com.google.android.voicesearch.audio.ByteArrayPlayer$1@424cca50
    
    02-20 14:05:05.791: I/ActivityManager(525): START u0 {act=com.google.android.gm.action.AUTO_SEND typ=text/plain cmp=com.google.android.gm/.AutoSendActivity (has extras)} from pid 8675
    02-20 14:05:05.821: I/AbstractCardView.SelfNoteCard(8675): #onViewDetachedFromWindow
    

    This makes me belive that google disposes the audioFocus from google now (the regonizerIntent), and that they use an audio recorder or something similar when the Note-to-self-tag appears in onPartialResults. I can not confirm this, has anyone else made tries to make this work?

提交回复
热议问题