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)
}
}
}