which background mode will apply to send data in background only on lost connection

I have a communication based app which is approved by Apple as of now. But I have an issue that I am trying to solve.


I have implemented push notifications correctly and I do not have any background mode enabled as of now.


How can I solve following issue:

  • User has no network connection as of now.
  • User opens the app.
  • User writes few messages to be sent when network is back up.
  • User closes the app expecting the app to send messages when network is up.
  • User did not open the app again.
  • Network came back up after 10 hours
  • Messages were not delivered.


I am sure this problem has been solved before.


My understanding is app does not have network access if its in background unless I make it a Voice over IP app. But my app is not VoIP.


So how can I detect network availability when in background and open the stream to send pending messages??



Best Regards,

Replies

Are you using HTTP[S] for your networking? Or is it some custom protocol on top of TCP or UDP?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

WWDC runs Mon, 13 Jun through to Fri, 17 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face. http://developer.apple.com/wwdc/

I use custom protocol which is on top of TCP.


At application level, I use XMPP.

I use custom protocol which is on top of TCP.

OK.

So how can I detect network availability when in background and open the stream to send pending messages??

There isn’t a way to do this. What you’re looking for is some sort of mechanism that resumes your app in the background when network conditions change. Such a facility does not exist.

If you’re using HTTP[S] you can schedule a task in a background session and the system will run that task when conditions are right (typically, when networking becomes available and the device has sufficient power). However, there’s no equivalent facility for custom protocols running over TCP.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

WWDC runs Mon, 13 Jun through to Fri, 17 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face. http://developer.apple.com/wwdc/