It would be great to know what the battery drain开发者_开发问答 rate is for different accuracy settings for the iOS standard location service while it is updating location constantly (I'm not talking about the significant changes service). I've tried using Instruments' Energy Usage tool but I can't seem to capture any info. At the same time, it is gonna take too long to sit there and time my iPhone to see how long it takes to die.
I know that the lesser the accuracy, the lesser the battery drain. But what are the solid numbers on this? Does anyone know?
Thanks!
I don't know any official numbers - it pretty much makes sense there aren't any, since it really depends on the use you are making of your device (WiFi/3g), and the location-use parameters (distance-filters, acceptable location timestamps, polling intervals etc)
BUT, UIDevice has exactly what you need to make your own measurements: [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
[[UIDevice currentDevice] batteryLevel]; [[UIDevice currentDevice] batteryState];
calculate your own statistics, just remember that other applications using the location may also affect the device battery life (for example: if your App received a cached location and accepted it, it prevented the device from using it's antennas to get newer locations...)
- Great post here
Like MCannon said, it is to do with the accuracy of the location services. In general the more accurate you are the more battery is used. I don;t have any concrete numbers on the differences though.
I presume it is to do with how quickly the phone can find the satellites and radio masts. The more accurate positioning requires longer to fix a position by listening to more satellites.
You can write a test app that runs continuously until the battery dies. Write a log statement every minute, or for whatever frequency will meet your needs. When the phone dies, look at the log. You'll see when the phone died.
精彩评论