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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -