Context:
iPhone is connected to the PC via cable and power indicated 100% ( the icon of the batter contains a small power plug also)
Question:
In this stage the phone is powered directly from USB or is it 开发者_StackOverflowusing the battery ?
Thanks
(From developer point of view): there's UIDeviceBatteryState
enumeration that contains the battery power state of the device. Among its possible values:
UIDeviceBatteryStateUnplugged: The device is not plugged into power; the battery is discharging
UIDeviceBatteryStateFull: The device is plugged into power and the battery is 100% charged.
So from these descriptions follows that device does not drain battery if it is plugged into power even if it is 100% charged.
I think the device is always drawing off the battery in order to guarantee a smooth power curve i.e. the battery works like a buffer of sorts. (It also simplifies the hardware.) However, when it is plugged in, the power system continually charges the battery so the net charge on the battery never changes.
I don't think that has any relevance to programming. Usually, you only need to know if a device is plugged in if you're doing something that might take longer than the battery can last. In that case, where the power comes from while plugged in really doesn't matter.
精彩评论