iOS background processing

Hi, I have an app that needs to use background processing in some circumstances, but not for all users. These users would rather not have the app running in the background and using up battery.

Is there any way to programatically turn background processing on/off?

thx

1 Like

bump.

any ideas on this anyone? thx

bump

I guess you should be more specific about what is background processing. If that’s a run loop then you don’t have much. But if that’s something like a cron service you can simply return as it’ll be called once in a while

Doesn’t really matter what’s running.

If you don’t declare the app has having background processing, then when it goes into the background, all processing in the app stops until you return it to the foreground.

What I’m asking is, if I declare it as having background processing, I can still then programatically tell it to stop any background processing when it goes into the background.

thx

Anyone from Juce any comments on this? thx

Do you mean background audio processing, as in UIBackgroundModes audio in the .plist? There’s no way to enable/disable plist entries at runtime so I doubt this is possible. Can’t you just not do any audio processing in the cases you don’t need to? There should be minimal impact on battery life, if any, if you aren’t doing anything.

yup, that’s what I’m doing, and that’s what I figured. One of the testers that complained I did a build for him with bg processing not enabled and he said his battery was fine. turned it back on and he said battery drained - nothing going on in the audio proc routine. could just be him i suppose - not had it from any one else

do we get notified in any way when the app moves from fg to bg and back again? thx

You’ll need to override JUCEApplicationBase::suspended() which will be called when your app enters the background, and ::resumed() will be called when it’s made active again.

1 Like

thx. i’ll try doing that and shutting everything down that isn’t needed.