cocoa touch - How to detect from an iPhone app whether iPhone battery is in charging or not? -
in iphone app, there requirement know whether iphone charging or not?
if charging want display alert same.
so how can detect whether iphone charging or not?
what should do?
please , suggest.
thanks.
[[uidevice currentdevice] setbatterymonitoringenabled:yes]; if ([[uidevice currentdevice] batterystate] != uidevicebatterystateunplugged) { //device connected (charging or charged) }
edit: if relly want check if device charging (and not 100% full yet), use uidevicebatterystatecharging
constant in if statement. see the documentation more information.
Comments
Post a Comment