1

I'm planning to develop an app reading data usage from the iPhone like each app internet usage , 3G, WiFi etc. My question is:

V1. Is it possible to keep app running in the background (even when is killed) and collecting a data and sending to the server every 15min?

V2. Is it possible to keep app running in the background (even when is killed) and collecting a data and send the data to the server once is reopen?

There are apps like which have similar functionality:

http://www.mobidia.com/products/takecontrol/

http://xvision.me/dataman

Thanks for your help.

2 Answers2

2

I don't think you're allowed to do either when the app is in suspended mode. There is no app code being executed at that state.

When your app is in background though there is only a limited number of tasks you are allowed to perform.

  • Apps that play audible content to the user while in the background, such as a music player app
  • Apps that record audio content while in the background.
  • Apps that keep users informed of their location at all times, such as a navigation app
  • Apps that support Voice over Internet Protocol (VoIP)
  • Apps that need to download and process new content regularly
  • Apps that receive regular updates from external accessories

For more info look here

Prashant
  • 1,014
  • 11
  • 28
0

First of all it is not possible to keep your app open if the user force quits, which I believe is what you mean by killed.

As far as background execution goes check out this informative answer: iPhone - Backgrounding to poll for events

In that answer it says you can't make recursive beginBackgroundTask calls, but I've seen a method where you make that call and then start location updates before the task dies. Then immediately shut of location updates and begin another background task. Here is a link to that method

Community
  • 1
  • 1
Mike Gottlieb
  • 966
  • 6
  • 11
  • What About this -> http://www.xcubelabs.com/blog/ios-7-background-execution-and-multitasking/ – user2892422 Oct 18 '13 at 00:10
  • Using the fetch and remote-notification background modes would be good for syncing the data. Remote-notification might even work for periodically collecting some data since you can send them silently and not disturb your users. I haven't used NSURLSession yet so I can't really speak to its effectiveness for your scenario. – Mike Gottlieb Oct 18 '13 at 00:28