appgyver

Open full view…

How to keep app running after screen is locked in iOS?

Niko Ruotsalainen
Sun, 24 Nov 2013 17:45:53 GMT

"Under iOS 5, if you want your app to still run when the device is locked, you will have to disable multi-tasking (UIApplicationExitsOnSuspend - YES) for your app." http://docs.appgyver.com/en/edge/cordova_events_events.md.html Where should I add this setting? I have tried to add following: <preference name="UIApplicationExitsOnSuspend" value="true" /> in config.ios.xml file without any effect. What is the correct place and syntax?

Matti Paksula
Thu, 28 Nov 2013 17:23:10 GMT

That part was not correctly transferred from Cordova docs to Steroids docs.. @satu, @harri a) what's up with the docs b) this feature is awesome, can we enable it?

Nick M
Fri, 29 Nov 2013 00:34:46 GMT

This would be pretty amazing...Any word on this guys?

Harri Sarsa
Fri, 29 Nov 2013 09:25:15 GMT

I've now fixed the docs, thanks for catching this! From a brief investigation, the `resign` event and the info below seems to be legacy stuff from the way iOS 5 handled app suspension to background, back when you could decide whether to enable or disable multitasking. `UIApplicationExistsOnSuspend` is a value in `Info.plist`, which will be exposed to the user to configure in an upcoming Build Service upgrade. Currently, you can't configure it. However, it's not much use: on iOS7, setting the value of the flag to `YES` (defaults to `NO`) simply makes your app terminate every time you press the home button or the lock button – no magic switch to enable background running, unfortunately. The iOS7 Background APIs provide some methods for this, but we haven't yet thoroughly investigated how they could be used to enhance Steroids apps. A custom plugin should be able to access them though!

Niko Ruotsalainen
Fri, 29 Nov 2013 10:01:37 GMT

Thanks for the answer! What I was actually looking is UIBackgroundModes. I have radio app and I want it to keep playing even when phone is locked or app is moved to the background. I managed to do it with PhoneGap, but it would be really cool to see this feature in upcoming Steroids updates as well.

Harri Sarsa
Mon, 02 Dec 2013 12:19:54 GMT

Yup, that'll be available after we update the Build Service to support an user-provided `Info.plist` file!