sunboykenneth / react-native-voicebox-speech-rec

A powerful speech recognition library for React Native applications, enabling real-time speech-to-text transcription.
MIT License
16 stars 2 forks source link

[Question] Is there a way to run recognition if app is killed? #4

Open alexzborovskii opened 6 months ago

alexzborovskii commented 6 months ago

I tried to use react-native-background-actions to start the microphone and recognition in background service, but microphone closes the moment I kill the app, simple counter in the same task continues to work. Maybe you have some advices or thoughts about this idea, I would really appreciate it.

I run the task like this (just in case):

`await new Promise(async resolve => {

    // open microphone, start recognize. works when app isn't killed
    startSpeechRecognition(); 

    // loop that works always
    for (let i = 0; BackgroundService.isRunning(); i++) {
      console.log('Runned -> ', i);
      await BackgroundService.updateNotification({ taskDesc:  ' i -> ' + i});
      await sleep(delay);
    }
  });`
sunboykenneth commented 6 months ago

That's a good question. I did something similar previously and did not make it work ..... At last I made my app only work in foreground.

alexzborovskii commented 5 months ago

@sunboykenneth thank you for your answer!