1

I am working on an iOS app where there is a requirement, due to which I have to update the device location to our server with an interval of one second.

I have set the 'AllowsBackgroundLocationUpdates' property of the 'CLLocationManager' to 'YES'. I have also set the Location services permission request mode to 'requestAlwaysAuthorization'. (I have also set 'LocationUpdates' in my required background mode capabilites.)

Due to this, even when my application is put in the background, the application remains awake. i.e; I can make API calls/ send socket messages even though my application is in the background.

I am aware the even for an application which does not have background modes enabled, the app remains awake in the background for a duration of about 10 seconds or more depending on battery and other variables.

When I performed tests, the app easily remains awake 2-3 hours which is sufficient for my requirement.

So, should I rely on my app remaining awake or would I need to create a 'BackgroundTask' to update the locations to the server?

Thanks.

PS: I know the above approach is battery inefficient but updates every second is what the client is demanding.

7vikram7
  • 2,764
  • 1
  • 25
  • 43
  • Have you seen this answer? Maybe this helps you... http://stackoverflow.com/a/30821461/6124910 – Patrick Mar 30 '16 at 09:26
  • Is it an Enterprise app? Then you do what you want. Does it go on the app store? Well, eating my battery is a good reason for Apple to reject the app. Your client can demand what they want, and you can implement it, but that doesn't mean Apple will allow it. – gnasher729 Mar 30 '16 at 09:34
  • @Patrick Thank you for your response. I had already checked the article. It states that when I do not set 'AllowsBackgroundLocationUpdates' to Yes, 'the app will still be subject to the usual task suspension rules.' But it does not give any clarity as to how long or with how much consistency the application will remain alive in the background when i actually set the flag to 'Yes'. – 7vikram7 Mar 30 '16 at 09:43
  • I'd appreciate a positive vote. Thank you very much and good luck – Patrick Mar 30 '16 at 09:45
  • @Patrick Please check my last comment which I have edited, I accidentally hit enter below I typed the whole thing. – 7vikram7 Mar 30 '16 at 09:47
  • @gnasher729 Thank you for your response. Apple rejection is not going to be an issue. Because we have created similar battery hungry apps earlier. As long as we mention heavy battery usage in the review notes as well as the app description on iTunes, Apple is fine with it. Also, the battery usage is going to be heavy only for a certain type of user of our app. And there are not going to be more than 10-15 such users. – 7vikram7 Mar 30 '16 at 09:59

0 Answers0