简体   繁体   中英

Speech recognition and speech to text on Android without any Google services

I am trying to make an application which uses speech to text for command input. I am making this for Android 6.0.1 and 5.1.1. I started by trying the examples with Google services, but none of them seem to work on my devices. Most of the time there is no clear error or a crash. I have gotten the no network error while using wifi and mobile internet. For the record, I did try to use the Google app speech recognition directly, but this gave no error nor answer. After that I have tried other examples which seem to not use Google services. I would also prefer for the example to work offline, but this is more of a preference than a requirement.

Some of the examples that I have tried:

Did not work on a device without Google - https://github.com/gotev/android-speech

I got a ERROR_INSUFFICIENT_PERMISSIONS error (RECORD_AUDIO and INTERNET were allowed) - http://www.truiton.com/2014/06/android-speech-recognition-without-dialog-custom-activity/

My main question is if such thing is at all possible and if yes then how (an example please)?


Fixed the insufficient permissions error using the example from: https://inducesmile.com/android/android-6-marshmallow-runtime-permissions-request-example/

Now I am getting ERROR_CLIENT error (I have no idea what it means).


the project
logcat output

Android devices ship with Google Mobile Services and some platform level functionality, such as an implementation of a RecognitionService which is used by SpeechRecognizer . The built-in service has support for offline functionality (and you can actually specify via option you prefer offline use). When not using offline support, it will need INTERNET permission.

However, your issue is most likely with the RECORD_AUDIO permission, particularly on Android 6+. Starting with Android 6 (Marshmallow, API 23) you have to use the runtime permissions model to gain access to any dangerous permission (which RECORD_AUDIO is.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM