0

I want to implement the heartbeat for my application. In this module, my iOS app will send byte of data to my server at regular intervals. I need this as the server wants the ack from device for being in touch with server when it sends a request.

Problem: If the application is quitted by user how will the heart-beat (byte of data) will be send to the server.

Barmar
  • 741,623
  • 53
  • 500
  • 612
Manmay
  • 539
  • 2
  • 12
  • 28
  • Your ability to run in the background on iOS is intentionally limited to certain tasks. I don't think you can do exactly what you describe. I'd look into using push notifications to send notifications to your app on iOS devices. – nielsbot Sep 06 '12 at 06:56

1 Answers1

1

The only way you can do it is register your application as VoIP type (the most problematic part, because if your app is not a messenger/conference/social type app Apple may refuse it) and then use NSStream in couple with NSInputStream/NSOutputStream and <NSStreamDelegate> interface to send/receive heartbeat.

Shebuka
  • 3,148
  • 1
  • 26
  • 43
  • Really thanks for your reply.. I was aware of this option, but what if the app is not running in background too? – Manmay Sep 06 '12 at 10:41
  • You can use same connection (StreamSocket) to send data in active and background execution. – Shebuka Sep 06 '12 at 11:06
  • SOrry dear, I repeat... the app is not running, i.e. neither in active state nor in background.... It is just installed.. So how can I interact with the server? – Manmay Sep 07 '12 at 05:17
  • Sorry, no idea of how do this... as i understand you want to do something like background non disableable agent on WP7. – Shebuka Sep 07 '12 at 12:38