LocoKit icon indicating copy to clipboard operation
LocoKit copied to clipboard

Battery usage optimization

Open shepelroman opened this issue 4 years ago • 1 comments

Hi Matt, Thank you for your open-source library. We are developing an app for personal tracking emissions of CO2. So we are using your library to detect transport user uses. We have an issue with battery usage. App track user activity all the time and the battery become dry very fast.

I used this: loco.dynamicallyAdjustDesiredAccuracy = true loco.useLowPowerSleepModeWhileStationary = true

Please may I ask your advice on how we can increase and optimize usage of a battery energy?

shepelroman avatar May 27 '20 08:05 shepelroman

Hi!

With those settings, LocoKit will be running at peak efficiency, and can maintain uninterrupted recording sessions for 24-48 hours on a single battery charge (or 2-4 days on larger model phones).

You should profile your app in Instruments Time Profiler for a while, examining the CPU time use of the UI, and potentially any background tasks you are using. The most likely candidate for excess energy consumption will be UI and other aspects of the app separate from LocoKit.

Also, at the moment your API key is disabled. I saw quite high API usage from your API key, but could find no contact information for yourself (name, email, etc), and couldn't find a website for your app. So you are possibly seeing increased CPU usage if your app is making repeated failed attempts to use LocoKit server API calls.

If you could provide me with some contact details, and information on my app, I can reenable your API key, to assist with the latter.

Thanks! Matt

sobri909 avatar May 27 '20 09:05 sobri909