tags:

views:

34

answers:

2

I want to play a song global in iPhone. If I quit the sound application and I dont pause the song then that song play globle in iphone.

A: 

That is possible since iOS 4 which allows you to perform some tasks in the background. Luckily playing audo is one of them. You need to read the Executing Code in the Background guide from Apple.

To break it down for you, first you need to see if your device supports multitasking:

UIDevice* device = [UIDevice currentDevice];
BOOL backgroundSupported = NO;
if ([device respondsToSelector:@selector(isMultitaskingSupported)])
   backgroundSupported = device.multitaskingSupported;

Then you need to edit your plist to declare that you are taking advantage of background tasks. You use UIBackgroundModes which takes an array of values, but you only need audio.

Then the actual coding, see Initiating Background Tasks.

willcodejavaforfood
thanks allot...
sidhu
no problems mate :)
willcodejavaforfood
sir how can i do audio streaming with play audio in the background in iphone
sidhu
@sidhu - You should create a new question for your new question :)
willcodejavaforfood
A: 

Yeah, it is possible. In the iOS4, you can play audio in the background

vodkhang