Sunday, April 28, 2024
HomeiOS Developmentios - Examine battery degree in background?

ios – Examine battery degree in background?


Is it attainable to verify battery degree in swift whereas our software is in background?

At present I’m engaged on one iOS software through which consumer shall be alerted with system notification when battery reached to 30%.

I attempted and I obtained notification randomly, generally 4%, generally 10%, mover than ever 30%.

func applicationDidEnterBackground(software: UIApplication) {
    if(UIDevice.currentDevice().batteryLevel <= 0.30 && UIDevice.currentDevice().batteryState != UIDeviceBatteryState.Charging)
    {
        Notification.addNotificationSystem("Mettre le transportable à charger", fireDate: 1, iconBadgeNumber: false)
        }
    }
}



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments