简体   繁体   English

在iOS中为电池充电所需的估计时间

[英]Estimated time required to charge battery in iOS

I am developing an iOS app, In which I need to calculate the estimated time required for charging the battery. 我正在开发一个iOS应用,其中需要计算为电池充电所需的估计时间。 I need to display like "Estimated time to get completely charged in 1:30 minutes". 我需要显示“预计的时间以在1:30分钟内完全充满电”。

I googled on this, but they all are displaying only current battery charging level. 我用谷歌搜索,但是它们都只显示当前的电池充电水平。

This seems like it is different for every phone, so one solution could be to start it at some constant rate. 似乎每个电话都不同,因此一种解决方案是以一定的速率启动它。 So basically every time a phone shows 40% you say that is 2 hours and just decrease it proportionally as it grows. 因此,基本上,每次电话显示40%时,您都说这是2个小时,随着时间的增长按比例减少它。 One cool thing you could do would be to log battery and time/date stamps during charge and take an average of those rates to get a more accurate time till fully charged. 您可以做的一件很酷的事情是在充电过程中记录电池和时间/日期戳,并取这些速率的平均值以得到更准确的时间直至充满电。

Example is when the app is running, log battery and time, every 5 minutes. 例如,当应用程序运行时,每5分钟记录一次电池和时间。 Save this data and formulate the avg 保存此数据并制定平均值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM