Android easy implementation of speech recognition details and example code

Using intent to call the speech recognition program

explain

Android mainly realizes speech recognition through recognizerintent. In fact, the code is relatively simple, but if the speech recognition device cannot be found, an exception activitynotfoundexception will be thrown, so we need to catch this exception. Moreover, speech recognition cannot be tested on the simulator, because speech recognition accesses Google cloud data, so if the mobile phone network is not turned on, it will not be able to recognize sound! Be sure to turn on the mobile phone network. If the mobile phone does not have voice recognition function, it cannot be enabled!

Note: the voice recognition program needs to be installed before use. For example, voice search uses voice recognition technology from Google, and intent can recognize the program.

This example refers to the Android routine:

development/samples/ApiDemos/src/com/example/android/apis/app/VoiceRecognition. java

Core code and description

The main principle is to send the voice to Google cloud, then process it in the cloud, match the corresponding data and send it to the client.

Finally, don't forget to add network access permissions to the manifest:

<uses-permission android:name="android.permission.INTERNET" />

Effect after operation:

The above is the data sorting of Android speech recognition. We will continue to supplement relevant data in the future. Thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>