UPDATE: I mean when the application has gone to background, the user closed it, iPhone is on the Springboard. Can be the connection kept alive?
I want to push some content to the clients. Is it possible? Do I have to register some... ...thing?
UPDATE: I mean when the application has gone to background, the user closed it, iPhone is on the Springboard. Can be the connection kept alive?
I want to push some content to the clients. Is it possible? Do I have to register some... ...thing?
Just register the app as a VoIP app, then a socket will be mantained in the background.
Page 60, and Page 180: http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/iphoneappprogrammingguide.pdf
The actual background task can be subject of App rejection, you have to be careful.
http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/
This should be a good start.
You can keep the connection alive for upto 10 minutes
UIBackgroundTaskIdentifier myLongTask;
myLongTask = [[UIApplicationsharedApplication]
beginBackgroundTaskWithExpirationHandler:^{
// If you're worried about exceeding 10 minutes, handle it here
}];
[[UIApplication sharedApplication] endBackgroundTask:myLongTask];
This will give you 10 minutes to check for a connection. After 8 minutes, you can use a local Push notification asking the user to open the app to extend it for another 10 minutes.