Is my Android App Draining Battery?
Solution 1:
Here is my suggestion:
I watch power consumption while developing my apps (that sometimes poll the sensors at rates of <25ns) using PowerTutor. Check it out, it sounds like this maybe what you are looking for, the app tells you what you are using in mW, J, or relative to the rest of the system. Also, results are broken down by CPU, WiFi, Display, (other radios installed). The only catch is that it is written for a specific phone model, but I use it with great success on my EVO 4G, Galaxy S (Sprint Epic), and Hero.
Good luck, -Steve
Solution 2:
There is a possibility that your game is draining battery. I believe this depends on several reasons, which reads as follows:
- Your application is a game. Games drains battery quickly.
- You're iterating with help from a
Thread
. Have you limited the FPS to make the CPU skip unnecessary iterations? Since you're working with 2D I assume you're using theSurfaceView
. 60 FPS will be enough for a real-time game. - You don't stop the
Thread
when your application terminates. Hence you reiterate code when your application isn't alive. - Have you an iterate lock that does
wait();
duringonPause
?
The people commenting that your game is leaking battery probably aims when your application isn't in use. Otherwise, it would be wierd because every game on Android Market drains battery - more or less.