how to calculate battery time,3g game play etc,iOS

匿名 (未验证) 提交于 2019-12-03 00:44:02

问题:

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.

I calculated the battery level

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

int batinfo=(batLeft*100); 

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

Thanks

回答1:

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

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]; 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!