user4806509
user4806509

Reputation: 3011

Does an iOS app use battery when in the background or when the device is locked?

I am working on an iOS project where the gyro and accelerometer is always on, has animations running as well as a timer.

What actually happens to the app on iOS 7 - iOS 10 when switching apps and the app is relegated to the background or when the device is locked -- does the gyro and accelerometer, running animations and timers automatically pause and turn off?

Should I expect when an app is relegated to the background or when the device is locked, the app stops drawing battery?

Or should I manually pause or turn off the gyro and accelerometer, running animations and timers when applicationDidEnterBackground is triggered and then recommence everything when applicationDidEnterForeground is triggered?

Upvotes: 1

Views: 278

Answers (2)

Ketan Parmar
Ketan Parmar

Reputation: 27428

Check Apple Documentation to know about background execution.

By default, when your app goes to background state then it's not performing any task.

You have to made setup for continue execution in background mode. And that have limitations also like you can not perform everything or anything that you want. You have limitations like, finite length task,location update,background music play, downloading, voip etc..! You can know more from above link.

So, if you have configured anything that's capable to works continue in background, then your app will consumes battery in background otherwise not.

Apple allows only some kind of tasks in background, and one major reason is long battery life !!!!

Upvotes: 1

vova sarkisyan
vova sarkisyan

Reputation: 56

Your app will stop, and without enabled specific background mode like location updates or Background Fetching it won't return to "run" until it will be in the foreground

The NSTimes will stop also. I think it's better practice to update the state in the applicationDidEnterBackground and applicationDidEnterForeground

Upvotes: 1

Related Questions