how to get low battery alert in iphone? -


i want display low battery alert programatically in iphone, when battery charge level low.

any 1 have idea this, please me. can find battery charge level using code

    uidevice *mydevice = [uidevice currentdevice];      [mydevice setbatterymonitoringenabled:yes];     mydevice.batterymonitoringenabled=yes;     float batterylevel = [mydevice batterylevel]; 

use battery level property uidevice. if battery level less 5% show alert example. pool periodically battery level in app delegate example.

uidevice *mydevice = [uidevice currentdevice];  [mydevice setbatterymonitoringenabled:yes];  float batterylevel = [mydevice batterylevel];  batterylevel - battery charge level device. 

batterylevel - battery level ranges 0.0 (fully discharged) 1.0 (100% charged). before accessing property, ensure battery monitoring enabled.

if battery monitoring not enabled, battery state uidevicebatterystateunknown , value of property –1.0.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -