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
2010-10-05 12:48:36
thanks allot...
sidhu
2010-10-05 13:08:48
no problems mate :)
willcodejavaforfood
2010-10-05 13:13:20
sir how can i do audio streaming with play audio in the background in iphone
sidhu
2010-10-05 14:17:29
@sidhu - You should create a new question for your new question :)
willcodejavaforfood
2010-10-05 14:34:16
A:
Yeah, it is possible. In the iOS4, you can play audio in the background
vodkhang
2010-10-05 13:11:10