I am building an app in which the user can enter data while being online and offline. This data has to be synchronized with a server. If the user is online that's not really a problem. But now I need to send the data the user entered while being offline, the moment he gets an internet connection (for instance when he leaves a plane and the phone connects to the network).
The current solution I have in mind is using background services available on iOS and Android to poll the server every X minutes to see if the phone is online. This doesn't seem to be too much of a problem for Android. iOs however seems to be harder. According to this post, iOS app upload data to server as soon as network is available, it's not possible. But it seems iOS 7 has added new background capabilities which may make this use case feasible. I just can't find any good examples or documentation about it.
So the core question is, how can I detect the fact that the phone comes online even when my app is not being used at the moment (and might even have not been used at all since the last restart of the phone)?