How To Check Low Battery Mode Setting While App Is In Background

454 Views Asked by At

My app has functionality that works while the device is in the background. I've come across a problem where I need to change functionality if the user turns off/on Low Power Mode, but I'm not sure how to do this if the app is in the background. Is there a way to check the state of the Low Power Mode setting every time it is changed while the app is in the background?

This is the code I want to use for checking Low Power Mode:

if NSProcessInfo.processInfo().lowPowerModeEnabled {
    // Low Power functionality
} else {
    // Normal functionality
}
0

There are 0 best solutions below