Curnelious
Curnelious

Reputation: 1

background app listen to audio input

Our app knows how to listen to the audio input. Can I open the app in the background (multi-tasking) and still get it to work as if it is open? Or can my app stay in the background and still get audio inputs,and output audio sounds? How i do that?

Upvotes: 0

Views: 260

Answers (2)

Patrick Goley
Patrick Goley

Reputation: 5417

Set your AudioSessionCategory as AVAudioSessionCategoryRecord. The docs explain here that this category will allow you to record audio input even when the app is in the background. This will allow you to listen to the device input in an AudioQueue recording callback function. However, when this is occurring in the background, the status bar is tinted red by the system to alert the user that a backgrounded app is listening (and possibly recording) device input.

Upvotes: 3

Randall
Randall

Reputation: 14839

The phone is only allowed to do a few things in the background, like play sounds, and monitor location. My guess is that this won't work, or if it does, it will be rejected by apple.

You may be able to get it working by playing a sound in the background and using that to keep the app alive to listen to the input. I'm not sure if this will work.

Upvotes: -2

Related Questions