I am working on an app to airplay audio to a supported device, similar to pandora. In the AppDelegate .h @interface I have:
In the .m I have:
I then add the required background mode in .plist of App plays audio in the background. When I am using Airplay, however, and try to run a different app, it pauses. Any ideas for how to accomplish this?
Code:
UIBackgroundTaskIdentifier *backgroundTask;
Code:
@implementation VideoAppAppDelegate
@synthesize window;
@synthesize viewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[window addSubview:viewController.view];
[window makeKeyAndVisible];
[[ UIApplication sharedApplication ] setIdleTimerDisabled: YES];
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
NSAssert(backgroundTask == UIBackgroundTaskInvalid, nil);
backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
[[UIApplication sharedApplication] endBackgroundTask:backgroundTask];
backgroundTask = UIBackgroundTaskInvalid;
}
- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}
@end