6 tips for developers to save battery usage in Android applications
Smartphones and tablets become more powerful each year but unfortunately, batteries don’t evolve at the same speed. Save battery usage in an Android application is essential for your users. Here, we offer to developers 6 tips to save battery usage when they make Android applications :
- Avoid using wake locks if your application really doesn’t need them. To be sure, go on the Android developer bible here and check if you need to keep screen on or to keep CPU on
- Be careful when you use location updates by entering correct criteria to avoid too much requests. Indeed, the more you request, the more battery you will use !
- Use the new JobScheduler API introduced in API Level 21. It lets your app to schedule various types of jobs against a framework that will be executed in your application’s own process matching some criteria
- Schedule secondary operations like analytics or logging when the user has plugged into a charger and on WiFi.
- Prefer WiFi to Data connection to download data when you can.
- Use a cache to limit data downloading when it’s relevant
To complete this article and learn how to schedule tasks on Android via JobScheduler API, you can use the following tutorial : https://www.ssaurel.com/blog/schedule-tasks-on-android-lollipop-with-jobscheduler-api/