peacemaker Expert Licensed User Longtime User Mar 21, 2016 #1 Hi, All I tried to use in background the speech recognition (in a service) 1) this "Another SpeechRecognizer Library" https://www.b4x.com/android/forum/threads/another-speechrecognizer-library.37584/ 2) and later modified this "Android Speech Recognition API Wrapper" class, to avoid using the lib: https://www.b4x.com/android/forum/threads/android-speech-recognition-api-wrapper.62959/ Both are working OK using online and offline downloaded language (Android 4.2.2 and Android 5.0 real devices), but .... only in the debug mode. Any Release (including non-obfuscated) compilation - stops working speech recognition :-( Compiled with targetSdkVersion="22", all sub names are with "_", no any system error in the log ..... I can publish the debug and release app APKs to try (it's simple but they are with RU interface). How to understand this issue?
Hi, All I tried to use in background the speech recognition (in a service) 1) this "Another SpeechRecognizer Library" https://www.b4x.com/android/forum/threads/another-speechrecognizer-library.37584/ 2) and later modified this "Android Speech Recognition API Wrapper" class, to avoid using the lib: https://www.b4x.com/android/forum/threads/android-speech-recognition-api-wrapper.62959/ Both are working OK using online and offline downloaded language (Android 4.2.2 and Android 5.0 real devices), but .... only in the debug mode. Any Release (including non-obfuscated) compilation - stops working speech recognition :-( Compiled with targetSdkVersion="22", all sub names are with "_", no any system error in the log ..... I can publish the debug and release app APKs to try (it's simple but they are with RU interface). How to understand this issue?
Erel B4X founder Staff member Licensed User Longtime User Mar 21, 2016 #2 Is there any error message in the logs? Upvote 0
peacemaker Expert Licensed User Longtime User Mar 21, 2016 #3 No, i mentioned. If not to suppress the start-stop beeps of SR - in release it beeps at start - at nothing happened next. Last edited: Mar 21, 2016 Upvote 0
No, i mentioned. If not to suppress the start-stop beeps of SR - in release it beeps at start - at nothing happened next.
Erel B4X founder Staff member Licensed User Longtime User Mar 21, 2016 #4 Might be related to this: Workaround the NetworkOnMainThread exception Upvote 0
peacemaker Expert Licensed User Longtime User Mar 21, 2016 #5 Erel, it have tried "DisableStrictMode" - no good news. But why - this SR can work well without Internet at all - it works in debug with offline downloaded language pack. Upvote 0
Erel, it have tried "DisableStrictMode" - no good news. But why - this SR can work well without Internet at all - it works in debug with offline downloaded language pack.
Erel B4X founder Staff member Licensed User Longtime User Mar 21, 2016 #6 It was just a guess as one of the differences between debug mode and release mode is that strict mode is disabled in debug mode. Have you tried it with a new empty project (only test this feature)? Upvote 0
It was just a guess as one of the differences between debug mode and release mode is that strict mode is disabled in debug mode. Have you tried it with a new empty project (only test this feature)?
peacemaker Expert Licensed User Longtime User Mar 21, 2016 #7 Hmmmm, as a new project - it's work after Release compilation !!! UPDATE: "_onError" sub at my project was "_Error": and i did not get errors, error 5 is here - RESULT_AUDIO_ERROR, mic channel is occupied by other sub listening the silence. Erel, thanks for idea Attachments background_speech_recognition_sample.zip background_speech_recognition_sample.zip 9.7 KB · Views: 674 Last edited: Mar 21, 2016 Upvote 0
Hmmmm, as a new project - it's work after Release compilation !!! UPDATE: "_onError" sub at my project was "_Error": and i did not get errors, error 5 is here - RESULT_AUDIO_ERROR, mic channel is occupied by other sub listening the silence. Erel, thanks for idea
peacemaker Expert Licensed User Longtime User Mar 22, 2016 #8 Erel, but the question is not answered :-( I had misprint in event sub name _Error instead of _onError, and this event is not fired. But why in debug mode the app works as needed fully - but when compile as Release - no recognition ?! If i fix the error in the sub name - i get standard errors from SpeechRecognizer object. Maybe debug mode uses many DoEvents ? Upvote 0
Erel, but the question is not answered :-( I had misprint in event sub name _Error instead of _onError, and this event is not fired. But why in debug mode the app works as needed fully - but when compile as Release - no recognition ?! If i fix the error in the sub name - i get standard errors from SpeechRecognizer object. Maybe debug mode uses many DoEvents ?
Erel B4X founder Staff member Licensed User Longtime User Mar 22, 2016 #9 peacemaker said: Maybe debug mode uses many DoEvents ? Click to expand... Debug mode doesn't use DoEvents at all. On my device it doesn't seem to work in both modes. I'm sorry but I'm not familiar with this library to further help you. Upvote 0
peacemaker said: Maybe debug mode uses many DoEvents ? Click to expand... Debug mode doesn't use DoEvents at all. On my device it doesn't seem to work in both modes. I'm sorry but I'm not familiar with this library to further help you.
peacemaker Expert Licensed User Longtime User Mar 22, 2016 #10 I added DoEvents after AudioRecorder.Stop before start SpeechRecognition - and it works now in Release mode. Upvote 0
I added DoEvents after AudioRecorder.Stop before start SpeechRecognition - and it works now in Release mode.
T tigleth Member Licensed User Longtime User Mar 22, 2016 #11 Hi; i installed your example without the lib; put a startservice in activity create; startserviceat and btn_Start code in Service_Start and it works online with phone asleep in release and debug; where can i get the downloaded language pack to use it offline ? I have no idea what is going on; i like talking to my phone when it is asleep. Thank u Upvote 0
Hi; i installed your example without the lib; put a startservice in activity create; startserviceat and btn_Start code in Service_Start and it works online with phone asleep in release and debug; where can i get the downloaded language pack to use it offline ? I have no idea what is going on; i like talking to my phone when it is asleep. Thank u
peacemaker Expert Licensed User Longtime User Mar 22, 2016 #12 tigleth said: where can i get the downloaded language pack to use it offline ? Click to expand... In the settings of Google speech recognition, by the settings button. Upload you sample to check, pls. Upvote 0
tigleth said: where can i get the downloaded language pack to use it offline ? Click to expand... In the settings of Google speech recognition, by the settings button. Upload you sample to check, pls.
T tigleth Member Licensed User Longtime User Mar 22, 2016 #13 Hi ; here is what I did just added some stuff to your code; it works online; do I need the speech library to use this offline ? I had the language pack already and did not know. Thank u I added example code to suppress some beeps. Attachments !testSR.zip !testSR.zip 454.2 KB · Views: 705 Last edited: Mar 22, 2016 Upvote 0
Hi ; here is what I did just added some stuff to your code; it works online; do I need the speech library to use this offline ? I had the language pack already and did not know. Thank u I added example code to suppress some beeps.