csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
348 stars 217 forks source link

bind to recognition service failed. Android #471

Closed DuQuanzhong closed 3 months ago

DuQuanzhong commented 3 months ago
截屏2024-01-04 15 27 27

Device Information: HUAWEI honor, system V: HarmonnyOS2.0.0

timmolter commented 3 months ago

Did you add the correct app permissions in the manifest?

DuQuanzhong commented 3 months ago
截屏2024-01-05 09 38 39 截屏2024-01-05 09 39 02

Hello, I have added these permissions. The recognition of speech can be completed on other Android phones, but not on this one.

DuQuanzhong commented 3 months ago

I saw someone else encountering the same issue. #431

timmolter commented 3 months ago

What Android version is running on that phone?

sowens-csd commented 3 months ago

Unfortunately not all Android devices follow the Android standard for the speech intent. There is one workaround in the package that works on some devices. Did you try the SpeechToText.androidIntentLookup option in the initialize call. Usage is like this:

await speech.initialize(
        onError: errorListener,
        onStatus: statusListener,
        options: [SpeechToText.androidIntentLookup],
      );

I have seen reports that this can crash on some devices because they have a secure intent that should not be bound. Let me know if you have a chance to try it.

DuQuanzhong commented 3 months ago

System info: WechatIMG1 my Code:

截屏2024-01-08 14 33 36

print:

截屏2024-01-08 14 32 41

I followed your instructions and wrote the code, but I am still encountering the same error.

DuQuanzhong commented 3 months ago

Android

This phone is running HarmonyOS V: 2.0.0.

timmolter commented 3 months ago

From what I can tell Harmony is different enough from Android to consider it a different operating system IMO.

https://www.gizchina.com/2023/01/28/harmonyos-vs-android-vs-ios-huawei-explains-the-main-difference/

DuQuanzhong commented 3 months ago

大不同,在我看来,Harmony 是一个不同的操作系统。

Thank you for your reply.

DuQuanzhong commented 3 months ago

D/SpeechToTextPlugin(27203): Start initialize D/SpeechToTextPlugin(27203): Checked permission D/SpeechToTextPlugin(27203): has permission, completing D/SpeechToTextPlugin(27203): completeInitialize D/SpeechToTextPlugin(27203): Testing recognition availability D/SpeechToTextPlugin(27203): sending result D/SpeechToTextPlugin(27203): leaving complete D/SpeechToTextPlugin(27203): leaving initializeIfPermitted D/SpeechToTextPlugin(27203): before setup intent D/SpeechToTextPlugin(27203): setupRecognizerIntent D/SpeechToTextPlugin(27203): after setup intent D/SpeechToTextPlugin(27203): Start listening D/SpeechToTextPlugin(27203): setupRecognizerIntent D/SpeechToTextPlugin(27203): Notify status:listening D/SpeechToTextPlugin(27203): Start listening done D/SpeechToTextPlugin(27203): Creating recognizer D/SpeechToTextPlugin(27203): RecognitionService, found: 1 D/SpeechToTextPlugin(27203): RecognitionService: packageName: com.google.android.googlequicksearchbox, name: com.google.android.voicesearch.serviceapi.GoogleRecognitionService D/SpeechToTextPlugin(27203): Setting listener after intent lookup D/SpeechToTextPlugin(27203): In RecognizerIntent apply D/SpeechToTextPlugin(27203): put model D/SpeechToTextPlugin(27203): put package D/SpeechToTextPlugin(27203): put partial E/SpeechRecognizer(27203): bind to recognition service failed [log] 状态:listening D/SpeechToTextPlugin(27203): Stop listening D/SpeechToTextPlugin(27203): Notify status:notListening D/SpeechToTextPlugin(27203): Notify status:doneNoResult D/SpeechToTextPlugin(27203): Stop listening done

DuQuanzhong commented 3 months ago

WechatIMG1

For HarmonyOS, you need to download "Google Assistant." When you open Google Assistant, it will redirect to voice settings. Choose Google, and you're all set.

DuQuanzhong commented 3 months ago

Thank you @sowens-csd @timmolter