What Kills Battery in an App with Location Tracking?

Sometimes we have to keep tracking user location for a lasting period of time. But such tracking often decreases battery life dramatically. There are a few things we should be aware of:

1. User route storing on SD card

In case we have to store the route the user took - we save location points to the database? but each record rewrites the database file. This activity will drain your battery real dry real quick.

2. Network location posting

Sometimes we have to post user location to the server, but posting requires establishing connection with a remote server using Wi-Fi or Mobile Internet. So such calls are quite expensive and triggering server call after each location update may consume a significant amount of energy.

3. Intensive GPS usage

GPS usage is another energy consuming operation, so developers may try disabling it and re-enabling in a few seconds in order to portion its usage and save battery. But GPS service drains much more energy on startup than in active mode. This means frequent start/stop callbacks can consume even more battery than non-stop GPS work.

4. Application WakeLock

WakeLock is dangerous feature because it isn’t exclusive for our app, it grants other applications  permission to continue working even while the device is in sleep mode. WakeLock is used when GPS is enabled automatically or it can be requested by the developer.

5. Motion Sensors usage

Motion sensors can be used in order to define if the user is moving or estimate his location but be aware: motion sensors can consume as much energy as GPS.

6. Frequent UI updates

If each location update triggers UI changes, the layout can be redrawn too often. In some cases, you can even lock the UI thread. So remember setting a reasonable location update interval, or at least filter locations in order to avoid too frequent UI updates.

SEE ALSO: 

0 Comments
I consent Lemberg Solution Ltd collecting and using provided personal information as set out in the Privacy Policy.

Lemberg is a technology consulting, software & hardware engineering company.

Startups and established businesses rely on our industry expertise to build new products and deliver digital transformation.

Join our Newsletter?