4

I'm writing an iOS app that uses the Dropbox Datastore API to sync data across multiple devices.

On Android, I'm able to tell the service to start on boot, which enables it to sync any changes that may have occurred whilst the device was turned off.

I'm having trouble finding a definitive way to have my app do the same on iOS.

So, does anyone have any recommendations to:

  • Run a simple background service efficiently and dependably on iOS.
  • Have the service start at boot

This must be possible - apps like Facebook and Gmail start syncing as soon as the device finishes booting.

Bryan Chen
  • 45,816
  • 18
  • 112
  • 143
Phillip Elm
  • 2,094
  • 2
  • 16
  • 27
  • it is not possible without jailbreak. Also Facebook/Gmail are using push notification, not background process – Bryan Chen Nov 20 '13 at 02:44

3 Answers3

8

Run a simple background service efficiently and dependably on iOS.

You cannot run background services on iOS. You can perform some operations in background, but the OS reserves the right of killing your app at any time.

Have the service start at boot

Impossible. Third-party applications cannot run automatically at boot on iOS.

This must be possible - apps like Facebook and Gmail start syncing as soon as the device finishes booting.

Given what stated above, I definitely can tell you that they don't. It might look like, but they cannot technically do that.

One option you have on iOS 7 is to have your app to refresh data in background when a special push notification is received, as discussed here. Long story short, you can send a push notification that triggers the data refresh and it's probably what Facebook and GMail do, in order to give the impression that the content was constantly updated in background.

Community
  • 1
  • 1
Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235
1

When your app is launched, it could begin updating / syncing Dropbox data in the background.

It is not possible to have a service that runs when the device boots. The Facebook app and Gmail app do not have a service / process that runs when the device boots.

bbarnhart
  • 6,620
  • 1
  • 40
  • 60
1

Just to be complete:

There are a number of IOS background modes (UIBackgroundModes) you can setup for an application.

There is one that does allow an application to be started on startup (if your app was running on shutdown) and also to be auto-restarted when it crashes (it's always restarted in the background). That is the "Voip" background app type.

Most likely not useful to you though as apple are very strict about what a "voip" application is and is not.

Shane Powell
  • 13,698
  • 2
  • 49
  • 61
  • I'm sure that the benefits of a "voip application" mode are needed among other non-voip apps - what is Apple's criteria for allowing it? My app has reminders that need to fire when the user sets them - ideally even if the device is restarted. These reminders are stored in Dropbox Datastores and accessed locally - I don't think PUSH notifications should be necessary for such simple functionality. Android couldn't have made this easier. I find it rather surprising that Apple doesn't make such a simple yet important feature more widely available. – Phillip Elm Nov 20 '13 at 20:34
  • 1
    Basically you need to be a full sip softphone to be passed as a voip app. The question basically asked if a app can start on startup, yes but only for voip apps. I think Apple come from the point of view that background apps use too much battery, so that rightly or wrongly limit what a application can / can not do in the background. – Shane Powell Nov 21 '13 at 04:45