如何计算电池时间,3g游戏等,iOS [英] how to calculate battery time,3g game play etc,iOS

查看:82
本文介绍了如何计算电池时间,3g游戏等,iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算
3D游戏,3G通话时间,视频使用,WiFi互联网,2G通话时间,音频使用和待机时间,具体取决于当前的电池电量。
有很多应用程序这样做,但我没有找到任何资源来计算在iOS中。

i want to calculate time for 3D gaming,3G Talk time,Video use,WiFi Internet,2G Talk time,Audio use and Standby depending on the current battery level. There are many app do this, but i didnt found any resource to calculate that in iOS.

我计算了电池电量


[myDevice setBatteryMonitoringEnabled:YES];
float batLeft = [myDevice batteryLevel];
int i = [myDevice batteryState];

[myDevice setBatteryMonitoringEnabled:YES]; float batLeft = [myDevice batteryLevel]; int i=[myDevice batteryState];

int batinfo=(batLeft*100);


现在基于batinfo,我需要计算时间剩下的其他参数。

now on the basis of batinfo,i need to calculate the time remaining for other parameters.

谢谢

推荐答案

Apple提供一些数据在设备规范中。您可以将它用于计算。

Apple provide some data in device specification. You can use it for your calculation.

例如Apple说,app。 3G通话时间为8小时( Iphone 5 )。
现在,

For example Apple say, app. 8 hours talk time on 3G (Iphone 5). Now,

int batinfo=(batLeft*100);
int minutes3G=480; //minutes of 8 hour (static)

int talk3G=(minutes3G*batinfo)/100; 
hour=talk3G/60;
min=talk3G%60;
lbl3Gtalk.text=[lbl3Gtalk.text stringByAppendingFormat:@"Remaining Time : %dh %dmin",hour,min];

这篇关于如何计算电池时间,3g游戏等,iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆