How is it possible that Google Fit app measures number of steps all the time without draining battery?

AndroidGpsAccelerometerAndroid SensorsGoogle Fit

Android Problem Overview


The Google Fit app, when installed, measures the duration you are walking or running, and also the number of steps all the time. However, strangely, using it does not seem to drain the battery. Other apps like Moves which seems to record number of steps pretty accurately declares that it uses a lot of power because of it constantly monitoring the GPS and the accelerometer.

I imagine several possibilities:

  • Wakes up the phone every minute or so, then analyses the sensors for a few seconds and then sleeps again. However it seems that the records are pretty accurate to the minute, so the waking up must be frequent.
  • Actually turns on the accelerometer all the time, and analyzes it only after the accelerometer measurement data buffer is full. However I think the accelerometer has a small buffer to store the latest measurements.
  • Use GPS to estimate the number of steps instead of actually counting it. However this should not be the case, since it works even indoors.

The app still feels magical. Counting steps the whole time without perceptible battery drain.

Android Solutions


Solution 1 - Android

Thanks for asking this question!

Battery is one of our top most concerns and we work hard to optimize Google Fit's battery usage and provide a magical experience. Google Fit uses a mix of sensors(Accelerometer, Step counter, Significant Motion counter), Machine Learning and heuristics to get the data right. Our algorithm is pretty similar to your 1st option plus a little bit of magic.

We periodically poll accelerometer and use Machine Learning and heuristics to correctly identify the activity and duration. For devices with hardware step counters, we use these step counters to monitor step counts. For older devices, we use the activity detected to predict the right number of steps. Our algorithms merge these activities, steps and sometimes location to correlate and further increase accuracy.

We do not poll GPS to estimate steps or detect activities.

-- Engineer on Google Fit Team.

Solution 2 - Android

On some very recent phones like the Nexus 5 (released in late 2013 with Android 4.4 KitKat), there is a dedicated low-power CPU core that can serve as a pedometer. Since this core consumes very little power and can compute steps by itself without the need for the entire CPU or the GPS, overall battery use is reduced greatly. On the recent iPhones, there is a similar microcontroller called the M7 coprocessor in the iPhone 5s and the M8 in the iPhone 6.

More information here:

https://developer.android.com/about/versions/kitkat.html

http://nexus5.wonderhowto.com/how-to/your-nexus-5-has-real-pedometer-built-in-heres-you-use-0151267/

http://www.androidbeat.com/2014/01/pedometer-nexus5-hardware-count-steps-walked/

Solution 3 - Android

having a 3 year old HTC OneX I can say that THERE IS NO DEDICATED HARDWARE, Google Fit just uses standard sensors in a very clever way. I come from Runtastic Pedometer: there is a clear battery consume when in use, it would be impossible to keep it on all the time as it needs the full accelerometer power. On the other side, if you stand still and shake the phone Runtastic will count the shakes, while Google Fit apparently does nothing... Still it works perfectly when you actually walk or run. Magic.

Solution 4 - Android

Google fit try to learn use pedo step pattern and try to create its own personal walking patterns and its clusters. This eliminates the need of having huge mathematics calculations on receiving sensor data every time. This makes Google fit more power efficient compared other software pedo apps. Having said that, there is compromise on accuracy factors here. Between power-accuracy trade off, google seems to be more aligned towards power factor here.

At this moment the most power efficient detection happens Samsung flagship & its other high end models. Thanks to Samsung's dedicated hardware chip! No matter how power efficient your software pedo algorithm be but its hard to beat dedicated hardware unit advantage. I also heard about Google's bringing dedicated hardware unit for Ped upcoming nexus devices.

Solution 5 - Android

It would seem like the solution would be device dependent, with devices where a co-motion processor or "wimpier" core is available for low power operations, that it would default to this once the buffer is full or similar condition. With devices where a low-power core is not available, it seems like waking the device could trigger a JIT operation that would/should finish by the time the app is called.

Solution 6 - Android

While the Nexus 5 does have a dedicated "low-power" pedometer built in. It isn't as "low power" as you might think.

My Nexus 5 battery life was decreased by about 25% when I had Google Fit Activity Detection switched on.

Also, the pedometer doesn't show up in the battery usage stats. Presumably, because it is a hardware thing.

Solution 7 - Android

I don't know for the other phones out there, but Google Fit was really draining my battery life on my Nexus 5. Disabling it definitely improved my battery life.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRandy Sugianto 'Yuku'View Question on Stackoverflow
Solution 1 - AndroidGouri JoshiView Answer on Stackoverflow
Solution 2 - Androidstackoverflowuser2010View Answer on Stackoverflow
Solution 3 - Androidalvise bagoliniView Answer on Stackoverflow
Solution 4 - AndroidPrakhsView Answer on Stackoverflow
Solution 5 - AndroidBBrownView Answer on Stackoverflow
Solution 6 - AndroidCraigoView Answer on Stackoverflow
Solution 7 - AndroidablaisView Answer on Stackoverflow