alphacep / vosk-android-service

Offline voice typing for Android
Apache License 2.0
55 stars 10 forks source link

queries block for recongitionservice per google api #29

Closed drew-sinha closed 1 year ago

drew-sinha commented 1 year ago

This is a fix to the android manifest that prevents bindings issues for the SpeechRecognizer. Prior to this fix, contemporary builds* would toast with a SpeechRecognizer loading error and logcat with an error similar to that described in #28 (E - SpeechRecognizer - org.vosk.service - failure to bind to recognition service; sorry... do not have the quoted logcat output).

Per the Android API (for builds toward Android 11+; see here ), this fix adds an explicit queries/intent block for RecognitionServices.

(At the time of this original merge request, #28 notes the same issue using a ?device with Android 9; but the compilesdk api level for the latest master is 33. Thus, #28 and this fix likely discuss the same error cases.)

The proposed changes eliminate the specified error, though still suffers from additional fatal run-time error addressed in #30 .

*The proposed change has been tested using: Source: alphacep master 099198e, current as of original merge request Build Configuration: Gradle Toolkit command-line, debug w/universal apk (compilesdk 33) Gradle toolkit version: 7.6 (defaults despite the build kts depending on 7.2.2; no api level spec'd); builds against OpenJDK-14 Device: Pixel 3 Device OS: Android 12 Additional Device Apps: AnySoftKeyboard (v1.11.7137/F-droid; UTD)

nshmyrev commented 1 year ago

Thanks a lot!