0

I'm fairly new to server/device communications so I apologize in advance if this question is trivial to some of you.

I am writing a native application for iOS which either gets or receives data from a server. The data is refreshed on the server every minute. Is it more efficient to send the data to the mobile device? or is it better to have the device pull the data from the server?

By data I mean 6 temperature values and 1 energy reading. The data is simple enough that I currently have it as just a text file (.txt) on the server.

I am thinking it would be more efficient for the mobile device to get the data from the server as needed since the device only needs the data while the app is in the foreground.

If you have a suggested method that would be great. I have looked through questions and have not seen this question asked or answered.

DCorrigan
  • 646
  • 1
  • 8
  • 18
  • 1
    Simply write your own sync process. Using NSUrlConnection, NSTimer yeah 3rd party web-server API such as AFNetworking. – Tirth Oct 03 '13 at 12:00
  • I looked up using NSUrlConnection and found a great explanation and how to run it in on a background thread. This will be a great solution for my application. I am guessing you think this would be more efficient, meaning less battery usage? – DCorrigan Oct 03 '13 at 13:56
  • Place NSUrlConnection call on sync communication using initWithRequest:delegate:startImmediately: method. It thread safe method as well. And it will reduced you headache to maintaining background communication. If you want to background downloading the other option you have use GCD go through this link http://stackoverflow.com/questions/14370325/gcd-main-vs-background-thread-for-updating-a-uiimageview – Tirth Oct 03 '13 at 16:11

0 Answers0