reduce battery consumption for android application

215 views Asked by At

I deigned an android application that uses PJSIP library and i am able to make calls using some sip id now i want to reduce the battery consumption of my application. How to approach to that. I tried with various options given in Google's official documentation how to consider those and implement into my application.

1

There are 1 answers

0
Zachary Hensley On

The question seems to be a bit generic, but a good place to start would be Android's documentation about optimizing battery life.

However, as you said you already looked at the official documentation, I believe a good next step is to trace calls with the Device Monitor, to see if something you are doing is taking longer than you expect: http://developer.android.com/tools/help/monitor.html

By tracing calls, you can get a percentage of the real time the application spends in certain methods. After tracing, you can examine the listing and see where you need to focus improvements to reduce CPU usage in those methods.

Examining the trace info

As displayed in the above picture, I found that my method was calling getRunningTasks() pretty often and using more CPU than I expected as a result. I could then go to that method and correct any errors that might cause that method to be called multiple times or such.

This link talks about tracing more specifically: http://developer.android.com/tools/help/systrace.html