My online radio app is playing background music. When the user listens to music and exits the app (enters background) to look elsewhere, I tear down the GKSession. It's P2P mode. When user returns to app, I reconnect GKSession.
Is this the right thing? And what to do if a phone call arrives or other interruption occurs? Also kill GKSession and recreate?
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
// Register for notifications when the application leaves the background state
// on its way to becoming the active application.
[defaultCenter addObserver:self
selector:@selector(setupSession)
name:UIApplicationWillEnterForegroundNotification
object:nil];
// Register for notifications when when the application enters the background.
[defaultCenter addObserver:self
selector:@selector(teardownSession)
name:UIApplicationDidEnterBackgroundNotification
object:nil];