I have an app that I'm using for my own purposes and is not in the app store. I would like to run an http server in the background for more than the allotted 3 minutes to allow persistent communications with a connected Bluetooth device. The Bluetooth device would poll the service at intervals. Is this possible to do? This app does not need app store approval since it's only for personal use.
Possible to allow x code builds to run background processes for over 3 minutes
You cannot run your app in the background for longer than the allotted time. Which incidentally is not 3 minutes, but much shorter.
You may want to read about iOS Background Execution Limits
In your case, as you have a Bluetooth device that is polling your app, if it polls faster than the time it takes for the system to suspend your app (which is more like 10 seconds, rather than 3 minutes), then you may be able to keep your app running.
But here are some important notes about this:
- keeping an app active like this to perform unrelated activities is not a supported case, and your mileage may vary. You would want to make sure you test this thoroughly
- This also goes directly against the App Review Guidelines, 2.5.4: Multitasking apps may only use background services for their intended purposes: VoIP, audio playback, location, task completion, local notifications, etc. and may get your app rejected if you ever decide to publish it with this workaround
- this would also be very power inefficient and quickly drain the battery on the device, and would be quite inconvenient and possibly unacceptable for general use outside of your own personal use.
Good luck, as you would definitely need it.
Argun Tekant / DTS Engineer / Core Technologies
Thank you for the detailed reply. My polling interval is around 5 minutes and I agree that it would be inefficient to operate in this way. Would the preferred approach be the inverse case where the Bluetooth device acts as the server?