Early last year I wrote an application to graph the battery usage of my new Android G1 phone. It uploads the battery status to my server and then rrdtool is used to produce graphs from the data. See Google Phone Battery Usage Graphing for more details, including the graphs. I’ve had a couple of requests for access to the source code recently, so I’ve tarred it up and put it here for download.Download Batmon.tgz (38kB) The Android app “uploads” data to the server by doing HTTP requests. The tarball includes both the Java for the Android app, and the Perl CGI which does the graphing. I’m making the source available with no warranty of any kind, feel free to pick it apart and do with it as you like. If anything, it should be a good example of how to create persistent Android processes that don’t chew the battery, as it deals with alarms and cpu locking.
Android Battery Graphing Source CodeWritten 7 years ago by Mike Cardwell