await SpeechRecognition.stop(); NOT WORKING !!!!
When my code runs I first remove any listeners if there are any
SpeechRecognition.removeAllListeners()
then I add
SpeechRecognition.addListener("result", (data) => {
if (data.matches && data.matches.length > 0) {
this.transcript = data.matches[0];
}
})
Then i start recording the user speak
await SpeechRecognition.start({
language: 'en-US',
partialResults: false, // ✅ disable partial results
popup: false,
})
When my application tries to stop the litening by running the below code, the application gets stuck on this line and no code runs after it.
const result = await SpeechRecognition.stop()
There is definately a bug in your software because I have found one more which I also submitted to you. But you wont fix it lol.
Hi team,
First of all, thank you for maintaining this plugin – it’s been really helpful for our Ionic + Capacitor projects. However, I’ve encountered a blocking issue on Android related to SpeechRecognition.stop() which I’ve tested multiple times and can consistently reproduce. I’m sharing detailed info below for your review:
Environment Ionic: 7.x Angular: 18.x Capacitor: 7.x Plugin: @capacitor-community/speech-recognition (latest version at the time of writing) Test devices: Android 13 (Samsung Galaxy / Pixel), iOS 17 (iPhone)
Steps to Reproduce
- Remove all listeners:
SpeechRecognition.removeAllListeners();
- Add a listener for result and state event:
SpeechRecognition.addListener('partialResult', (data) => {
console.log('Result:', data);
});
SpeechRecognition.addListener('listeningState', (status) => {
console.log('Status:', status);
});
- Start speech recognition:
await SpeechRecognition.start({
language: 'en-US',
partialResults: true, // also tested with false
popup: false,
});
- After a few seconds, try to stop speech recognition:
const result = await SpeechRecognition.stop();
console.log('Stopped:', result);
Expected Behavior
stop() should resolve and return a proper stopped status.
The listeningState event should emit "stopped" after calling stop().
Actual Behavior on Android
await SpeechRecognition.stop() never resolves → application code hangs at this point.
listeningState only emits "started" and never emits "stopped".
If popup = true, the app goes to background (Android system behavior), so no listener events are triggered.
Actual Behavior on iOS
Works as expected: stop() resolves and listeningState emits "stopped".
Impact
On Android, it’s impossible to properly stop recognition programmatically, leading to broken UX (cannot end speech recognition session manually).
Suggestion
Please review the Android native implementation of stop(). It seems that the promise is not being resolved or the "stopped" state is never emitted when popup = false or partialResults = true.
Align Android behavior with iOS so that stop() consistently resolves and emits "stopped" event across platforms.
Would appreciate if you could confirm whether this is a known issue or if there’s any workaround until a fix is available. Thanks a lot for your time and support! 🙏
Is there a way to keep the microphone listening indefinitely and not drop off after the user finished talking? I ask this because every time the user stops talking the microphone session ends and my application needs to restart listening again.
Yahoo Mail: Search, organise, conquer
On Tue, 5 Aug 2025 at 9:31 pm, Phạm Bá @.***> wrote: vietpham94 left a comment (capacitor-community/speech-recognition#122) Hi team,
First of all, thank you for maintaining this plugin – it’s been really helpful for our Ionic + Capacitor projects. However, I’ve encountered a blocking issue on Android related to SpeechRecognition.stop() which I’ve tested multiple times and can consistently reproduce. I’m sharing detailed info below for your review:
Environment Ionic: 7.x Angular: 18.x Capacitor: 7.x Plugin: @capacitor-community/speech-recognition (latest version at the time of writing) Test devices: Android 13 (Samsung Galaxy / Pixel), iOS 17 (iPhone)
Steps to Reproduce
- Remove all listeners:
SpeechRecognition.removeAllListeners();
- Add a listener for result and state event: SpeechRecognition.addListener('partialResult', (data) => { console.log('Result:', data); });
SpeechRecognition.addListener('listeningState', (status) => { console.log('Status:', status); });
-
Start speech recognition: await SpeechRecognition.start({ language: 'en-US', partialResults: true, // also tested with false popup: false, });
-
After a few seconds, try to stop speech recognition: const result = await SpeechRecognition.stop(); console.log('Stopped:', result);
Expected Behavior
stop() should resolve and return a proper stopped status.
The listeningState event should emit "stopped" after calling stop().
Actual Behavior on Android
await SpeechRecognition.stop() never resolves → application code hangs at this point.
listeningState only emits "started" and never emits "stopped".
If popup = true, the app goes to background (Android system behavior), so no listener events are triggered.
Actual Behavior on iOS
Works as expected: stop() resolves and listeningState emits "stopped".
Impact
On Android, it’s impossible to properly stop recognition programmatically, leading to broken UX (cannot end speech recognition session manually).
Suggestion
Please review the Android native implementation of stop(). It seems that the promise is not being resolved or the "stopped" state is never emitted when popup = false or partialResults = true.
Align Android behavior with iOS so that stop() consistently resolves and emits "stopped" event across platforms.
Would appreciate if you could confirm whether this is a known issue or if there’s any workaround until a fix is available. Thanks a lot for your time and support! 🙏
@capacitor-community/maintainers (or @Specific maintainer handle if known)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
I know this is hacky but on android the hang can be solved with this. Not sure why no one fixes it. The devs just don't care.
await Promise.race([
SpeechRecognition.stop(),
new Promise(
(resolve, reject) => setTimeout(() => reject(new Error("Timeout on stop()")), 400) // set whatever timeout
),
])