30 November, 2021

How to Develop Android Apps with Minimum Power Intake and Maximum Efficiency?

The hyper problem in Android mobile devices is its power consumption. Most devices don’t have much per day battery life, when compared to iPhones or Windows mobiles. This is because the applications in the Android phones are not optimized with the latest version of Android OS to reduce power usage. After some researches and implementations, we have found a few solutions to better the battery life.

Task execution time:

Many applications fetch data from internet frequently, even this can lead to battery drain. Battery use is directly proportional to the execution time of a task that fetches data from internet or other tasks. So you need to reduce the execution time, how to do it?

1. Implement Asynchronous task, in which you use execute() to execute the Aysc Task. If you have executed 2 Aysc tasks like first A and B, then B will wait till A gets finished, this will increase execution time. Instead use executeOnExecutor() to execute A and B, now B does not wait for A, both execute in parallel.

2. Reduce the number of Aysc task in total, fetch most of the data(optimized for mobile), in a single Aysc task.

3. Use Interfaces instead of broadcast receivers.

4. Data like XML, Json data should be in optimized for mobile.

Optimized API data: (Not for public feeds)

1. Fetch the data only that you use in the application.

2. Reduce the bytes of data being fetched; this will reduce the execution time.

3. If you are building a web service avoid using lengthy tags like “product_description”, instead use “pd”. This will be very useful while fetching array of data for your application.

4. Images in the API should be optimized for mobile. (Reduce image size)

Background process:

The background process in Android kills more power, compared to other activities. Even though background is implemented only when the application is required, it consumes battery life a lot.

GPS location, alarm clock, live updates, etc. are some popular background processes.

How to reduce it?

1. Eliminate background process on screen-off mode. (Not applicable for applications with live updates)

2. Use Google play services 3.2 for GPS location which uses less battery for location update.

3. For applications with live updates, have an option for users to enable live updates on Screen-off mode.

4. Kill unwanted background services.

Other ideas that might work:

1. Optimizing the application design, use colors and drawables instead of images as this can reduce the application loading time.

2. Developing application for ICS or later, which already has some power consumption modes.

3. Get data from API and save it in local device database, then fetch only the updated records from the web service, instead of fetching all records every time.

4. If you are building a web service, have a server which has better response time and bandwidth.

5. Reading Designing for Performance on Android Developers Website and trying to implement the ideas discussed there.

I hope the above stated tips are useful and help any Android app developer in the process of creating an application with less power consumption and maximum efficiency.

I'm an independent developer and blogger. I do research on some technologies i worked and prefer to share my knowledge on the same. I'm a beginner in the world wide knowledge sharing environment.

2 Comments

  1. Beverly Reply

    Background application in mobile devices ruin the battery much, it’s good to read here and know how to set off screen mode.

Leave a Reply

Your email address will not be published. Required fields are marked *