iPhone - voice recording in background - iphone

I'm using AVAudioRecorder and able to record voice of the user.
But how can I countinue recording the voice when the app goes to background also?

Honestly, it is allowed, you should set the key UIBackgroundModes's value to audio in the application's Info.plist file.

Related

Will an NSLocalNotification Sound Play When the Phone is set to Silent?

Is it possible for an NSLocalNotification to play an audio file when the ringer switch is set to OFF?
No. NSLocalNotification must adhere to the device's real world settings.

iOS: allow user to choose whether audio will play in background or not

My app is able to play audio in the background. However, I'd like for it to not play audio in the background by default. I'd like to have a user preference which controls whether audio is played in the background or not.
Background audio is controlled via UIBackgroundModes info.plist. If I use this setting to allow background audio, my app will always play audio in the background. Is there a programmatic way to display playing audio in the background? Or do I need to do something less graceful, like fading audio in and out on my own when the app enters or leaves the background state?
Either depend on the Settings app, or provide the user a way in your app to set this preference, before your app is put in the background. Then continue to play or cut the sound depending on that setting, assuming you have set UIBackgroundModes to give your app the option.

Can a iPhone voice Recorder App always run in Background recording the Sounds and Play them?

Can a App record the Voice in the surroundings even when it runs in the background and play the recorded audio? Is it possible?
Multitasking doesn't allow audio recording to be in the background, so no.

IPhone AudioStreamer doesn't work on background OS4

I use Matt Galagher's AudioStreamer http://github.com/mattgallagher/AudioStreamer/ It works fine, however how to make in work at background on IPhone OS4?
Check out this document, in particular:
Applications that play audio can continue playing that audio while in the background. To indicate that your application plays background audio, include the UIBackgroundModes key to its Info.plist file. The value for this key is an array containing the audio string. When this key is present, the system’s audio frameworks automatically prevent your application from being suspended when it moves to the background. Your application continues to run in the background as long as it is playing audio. However, if this key is not present when the application moves to the background, or if your application stops playing audio while in the background, your application is suspended.
You can use any of the system audio frameworks to initiate the playback of background audio and the process for using those frameworks is unchanged. Because your application is not suspended while playing audio, the audio callbacks operate normally while your application is in the background. While running in the background, your application should limit itself to doing only the work necessary to provide audio data for playback. Thus, a streaming audio application would download any new data from its server and push the current audio samples out for playback.

AVAudioPlayer can play while iPhone screen is locked; can it record at that time too?

You can easily play sounds and record sounds using the high level AVAudioPlayer. And you can play sounds using the same framework, while the iPhone screen is locked. Can you record sounds at that time?
Yes, of course, just set correct category....................................................................................................................................
""AVAudioSessionCategoryRecord
For recording audio; this category silences playback audio. Recording continues with the screen locked.
Available in iPhone OS 3.0 and later.
Declared in AVAudioSession.h.
AVAudioSessionCategoryPlayAndRecord
For recording and playback of audio—simultaneous or not—such as for a VOIP (voice over IP) application.
This category silences audio from other applications, such as the iPod. You can, however, modify this category to allow mixing by using the kAudioSessionProperty_OverrideCategoryMixWithOthers property. Your audio continues with the Ring/Silent switch set to silent and with the screen locked.