0

I'm building an app that includes an audio recorder which should be able to record background audio for an indefinite length of time. So far, I seemingly have this working on an Android API v26 emulator.

The problem only crops up when I run a test build on my actual device (API v33). It's able to record audio in the background for a bit (while unfocused, locked, etc.), but it inevitably cuts out. It's usually after 20 seconds to a minute or so, and the app doesn't regain access to the microphone until it's focused again. This seemingly does not occur on the emulator, as all audio is retained even after it has been locked for several minutes.

I don't believe this is due to the app being put to sleep, as audio recordings always include appropriate length chunks of completely silent audio. This behavior is similar to when I tested using another app that needs the microphone (recording video), as both result in silent audio for the length of the microphone being inaccessible to the app.

To record audio, I'm using the flutter_sound package. I am on Flutter version 3.7.5.

Is this a permissions issue, i.e. the distinction of giving an app access to the microphone "only while I'm using the app"? Or is the OS taking back control of the microphone from a seemingly inactive app?

coolbrd
  • 1
  • 1
  • Not sure on the solution but there is more details here: https://stackoverflow.com/questions/74774636/samsung-phone-will-not-allow-audio-recording-at-lock-screen "general Android policy that only allows certain system-level services, such as the media player, to access the microphone while the device is locked" – Wh1t3rabbit Jun 06 '23 at 23:23

0 Answers0