开发者

Finding Capacity Remaining In An iPhone Battery

Does anyone know how (if possible) I can find out how much capacity (mAh) is remaining in an iPhone battery at any given time?

Finding Capacity Remaining In An iPhone Battery

Something like the program above?

开发者_如何学运维

Is there a value stored in a plist somewhere??


couple ways,

  • pre 3.0 sdk: http://blog.coriolis.ch/reading-the-battery-level-programmatically/

  • with 3.0 sdk - the UIDevice batteryLevel property (example: http://blog.coriolis.ch/reading-the-battery-level-programmatically/#comment-4607)

to gauge the mAh you could check the battery level over time using that method.

3.0 has added an event to do that:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(batteryChanged:)
name:@”UIDeviceBatteryLevelDidChangeNotification” object:device];

in general, measuring the open circuit voltage or current is used to gauge the state of charge by the hardware. the capacity of the bat will shrink over time, so 100% will indicate no more charge can be stored, even tho the capacity is lower than a new iphone battery.


The UIDevice API includes a property relating to battery level.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜