I took from here an example for working with voice. Tell me how to make the “microphone” appearing from the Google API not visible (press the button, speak and get the result of the above, without this graphical visualization).

  • The answer is to continue . - tim_taller 6:08 pm

3 answers 3

You can not call the Voice Recognition Activity , but take the source code of this activity and transfer it to your project, then you will be able to embed the UI in your application at your own discretion. How this is done can be viewed in the source code for LatinIME (folder voice) - there are 7 files and more than 1000 lines of code under the Apache license.

    There is another way:

    • Get the raw data from the microphone using the AudioRecord class (description, for example, here )
    • We encode data in flac format using JavaFlacEncoder
    • Send the file to https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=en-RU with content-type: "audio / x-flac; rate = 16000"
    • We receive the json-answer with variants of the text.

      The answer is .