[App] BattMonX (Droid X Battery State Monitor via LED Status)

Search This thread

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
BattMonX is a utility for the Motorola Droid X (also works for other Motorola Droid-class phones) for turning on a phone's LED indicator light (when the screen is off) to represent the battery's current state (charging, charged, discharging, or low-battery). Version 1.8 now allows a rooted Motorola Droid-class phone to have the LED on while the screen is on. This app was originally written for the Motorola Droid X whose LED indicator was not enabled during charging like many other phones do.

Additionally, for phones like the Droid X with a tri-color LED (red/green/blue), a variety of colors may be selected to differentiate the various battery states (OFF, red, green, blue, yellow, orange, deep sky blue, dark violet, dark green, and dark orange). Version 1.8 includes the color "amber" for those phones that support an amber LED indicator. Also, rooted Motorola Droid-class phones can choose "white" as a color option when used with the "LED is Always ON" experimental (and root-only) feature.

PHONE COMPATIBILITY

This app will not work on all phones. For example, the Samsung Vibrant and Captivate do not have LED indicators. Some phones only have a two-color LED (the HTC Eris and Evo 4G both have a green/amber LED; the Epic 4G supports a red/blue LED) which might allow for partial functionality from this app (especially if rooted). Additionally, its clear from testing that some phone's firmware interferes or does not fully implement the standard Android LED notification functionality identically to the Motorola Droid-class of phones.

Extensive logic has been added in version 1.7 and 1.8 in an attempt to support other phones. Version 1.8 now implements a strategy for dynamically finding a phone's battery state files (specifically the "status" and "capacity" files). Additionally, the LED notification directories are identified to determine their location and which color brightness files are supported by your phone's LED. Please contact me at scary.alien@gmail.com for instructions on how to provide debugging information so I can try to support your phone.

USAGE and NOTES

* Launch the BattMonX app and press the "Start Monitoring Battery Status" button. Monitoring will take place in the background and the app may be safely exited via the BACK or HOME keys.

* While monitoring is active/enabled, the app will check the battery state at a user-selectable polling interval and set the LED state as specified.

* To exit the BattMonX UI but continue monitoring, use the BACK or the HOME key--the app's service logic will continue monitoring the battery state in the background.

* To discontinue monitoring, recall or re-launch the app and press the "Stop Monitoring and Exit" button.

* Version 1.6 and higher now allows BattMonX to work alongside SMS text notifications. After viewing the text message or clearing the notification, BattMonX will resume battery state monitoring at the start of the next polling interval. Version 1.8 of the app implements a new strategy to make the app much more responsive (30 seconds or less) to SMS notifications.

* To have the app automatically monitor the battery state after a reboot, enable the "Set on Boot" option in the second menu page.

* Use the "Display Current Settings" menu item to see app's current state and settings.

* Use of the low-battery indicator is optional. If enabled however, it will take precedence over all other settings (i.e., as long as the current battery percentage full is less than or equal to the low-battery threshold, the low-battery action will be taken and used regardless of the other charging or discharging settings).

* This app does NOT require root; requires minimal permissions; uses very little CPU and system resources. Version 1.8 does include some new experimental features that require root such as the "LED Always On" feature to enable turning the LED on while the screen is on (not available on a stock Droid X).

* If you use a task killer, be sure to exclude the BattMonX app.

* You should also be aware that many phones turn OFF the LED when turning the screen on or off. The app should re-light the LED when/if appropriate at the top of the next polling interval. Additionally, Android will suspend non-system app processing when the screen is turned off. This might cause BattMonX to not be able to update the LED status while the screen is off since it (and all other apps) are not being given CPU cycles for processing. When the screen is turned back on or an SMS text message is received, the app should wake-up and resume updating the LED status as normal.

EXPERIMENTAL FEATURES

Version 1.8 brings some new experimental features to BattMonX:

- An "LED is always ON" (for rooted phones only) to light the LED while the screen is on (normally, at least for the Droid X) the LED is only display while the screen is off. This experimental feature bypasses the notification API and updates the LED notification's brightness files directly. If you use this feature with the set-on-boot option, be sure that you tell the SuperUser app to "remember" the "allow" setting so that the app will resume expected monitoring (otherwise, the app will automatically turn off the "LED is always ON" setting). Also, there is currently no "blink" functionality available when the "LED is always ON" setting is used.

- I have included an LED Color Tester to allow you to test your own phone's LED color display ability. Note: use the menu's "Current Settings" option to display which LED colors your phone supports that the app has auto-identified for you (scroll to the bottom in the "Miscellaneous" section). If your phone is not rooted, you'll have to suspend monitoring first and turn your screen off to see the results of your color test. If your phone is rooted and you've enabled the "LED is always ON" setting, you'll be able to see the results of your color test immediately while the screen is on.

- I've included an option "Locate Battery / LED Files" option to explicitly locate and display the battery state directory, LED notification directory, and supported LED colors. For non-Motorola Droid-class phones, this function is performed automatically after first install (and is not necessary (but harmless) for Motorola Droid-class phones).

PERMISSIONS

- BattMonX monitors for the receipt of SMS message notifications (android.permission.RECEIVE_SMS) for the purpose of stepping-aside when an SMS text arrives so that the SMS notification (i.e., blinking green LED) can be displayed. No actual SMS messages are read--the app only receives the SMS broadcast action.

- The app also receives a notification of when the phone has rebooted (android.permission.RECEIVE_BOOT_COMPLETED) for the purpose of restarting the battery state monitoring automatically after a reboot. You can enable or disable this feature in the menu (Preferences / Settings -> Set On Boot (checked or un-checked)).

- BattMonX uses the android.permission.WRITE_EXTERNAL_STORAGE to create a temporary file on the /sdcard containing the list of files in the /sys/devices/platform directory structure in order to automatically identify the battery state (status and capacity) and LED notification (<led-color>/brightness) files.

For screen shots and additional information, please visit https://sites.google.com/site/scaryalienware

Thanks again to everyone for their feedback and suggestions!

Please contact me at scary.alien@gmail.com is you have any issues, questions, comments, or suggestions. Cheers!

Screen Shots

01-main-screen.jpg 02-pref-screen1.jpg 03-pref-screen2.jpg 04-pref-screen3.jpg 05-pref-screen4.jpg 06-pref-screen5.jpg 07-led-color-tester.jpg

QR code: qr-code.jpg
 
Last edited:

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
v1.3 just published: now supports set-on-boot feature!

Just a quick thread bump to let everyone know that I've updated the app to version 1.3 that now includes a set-on-boot / run-on-boot option.

Select this option via the menu (menu -> More -> Set on Boot -> select True or False).

Enjoy!
 

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
version 1.4 just uploaded to the Market

All,

Just wanted to let everyone know that v1.4 is out and includes the ability to monitor for a low-battery condition.

You can set a percentage threshold at which the LED will be turned on (or not) to a selected color and optionally have it blink.

I've also added five new colors to select from for setting the LED to the various battery states.

Here's the change log:

version 1.4:

* supported optional low-battery status indicator:

- action: none, LED on, LED blink
- threshold: 10%, 20%, 30%, or 40%
- LED color

* supported new LED colors in addition to the original red, green, blue, yellow, and OFF:

- dark orange
- orange
- dark violet
- dark green
- deep sky blue


Cheers!
 

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
v1.6 just uploaded: now works w/SMS text notifications

All,

Just a quick thread-bump to let everyone know about the latest release of the app: version 1.6 now works with SMS text notifications!

So now, you should be able to run the app all of the time and still get notified when a text message comes in.

The timeliness of the seeing the SMS notification is still dependent on the polling interval you are using, but app steps aside when the SMS notification comes in and then resumes when its been acknowledged (by reading the text) or cleared (by the notification pull-down's Clear button).

Please note that the app doesn't actually control the color or blinking status of the SMS text notification, my app just allows it to come in and been seen--so I cannot change its color or behavior (sorry).

I also added the option / ability to make the LEDs blink (or stay on like before) for the charging / discharging / charged state like the functionality I added for the low-battery condition in v1.4.

Anyway, I hope everyone has a safe and happy holiday!

Enjoy the app and its recent changes--I very much appreciate everyone's feedback and support!

By the way, I am going to try to move all of the configuration stuff currently in the menus to the "shared preferences" settings (that will look like the Settings configuration menu we all know and love).
 

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
I wonder if it's at all possible to notify of a possible wake lock?

Swyped from my Cyanogen Evo

Wow! Thanks for melting my brain ;) :p ... after reading through this (http://source.android.com/porting/power_management.html#androidPowerWakeLocks).

Didn't know too much about wake locks before this (or even afterwards, lol).

Interesting idea...not sure if I could monitor for these (there is no obvious broadcast action event that is sent-out for wake-locks that I could listen for).

Thanks for the suggestion...I'll keep this in mind for the future though.
 

cowboyboats

Senior Member
Jul 30, 2010
116
17
Sorry, I was thinking if it could notify of low battery then it might be possible to add a feature that would notify high voltage discharge while screen was off. Since roms should under volt while the screen is off. Maybe a feature our something but I may not fully understand it

Swyped from my Cyanogen Evo
 

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
v1.7 just uploaded to Market (very useful fixes and improvements)

version 1.7 changes include:

- added strategy to auto-recover from Android auto-killing the app's service; should make the app much more stable and without unwanted shutdowns

- replaced multiple menu settings w/standard Settings/Preferences menu item

- dynamically determine battery status directory (I did this to see if the app would work on more phones (with mixed success); should allow for users that don't see that the app was written for the Droid X to at least see if it will work on their phone (does not appear to work on a stock HTC Evo 4G, HTC Droid Eris))

- re-instituted screen lock to portrait mode to prevent orientation change from causing FCs

- fixed integer parsing issue causing some reported crashes (probably just experienced by non-Droid X phones)

- added option for 3 minute polling-interval

- added larger range for low-battery percentage threshold

- fixed issue where LED would not blink when charging

Anyway, if you have any issues, comments, questions, etc., please contact me at scary.alien@gmail.com.

Cheers and have a great New Year!
 

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
Is it possible to add an option so the app stops monitoring when the battery is fully charged?

Sure...but let me make sure I totally understand... Would you want to stop monitoring and exit or stop lighting the LED when charged? (I'd have to keep monitoring to see that its still charged).

By the way, are you rooted? I've been testing a version this past weekend that will light the LED while the screen is on (only for rooted phones, I'm afraid).

edit: sorry, I do see that you are rooted...cool :cool: you are going to like the next version. ;)

I'm also testing a "Suspend" checkbox on the main screen so you can pause the display of the LED and monitoring while its checked. This is kind of a preliminary step towards being able to set a scheduled "turn off LED" time and duration (i.e., for at night when you don't want to see the LED lit).

The next version will also be much more responsive towards things like SMS/text notifications (the app won't always have to wait until the top of the next polling interval to "see" when some events like SMS messages coming in or preferences being changed--this will allow you to have longer polling-intervals without loss of functionality).

Let me know...I'm always looking for new ideas. :)

Cheers!
 

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
v1.8 just published to the Market

All,

I've just published version 1.8 to the Market and updated the first post with information and screenshots... Lots of new features and improvements. Change log for 1.8 includes:

- supported new experimental features:

* ability to keep LED on while the screen is on (root only)

* support white LED color when used with the "LED is Always ON" experimental (root-only) feature/setting

- updated w/better strategy for dynamically locating battery state and LED notification files to TRY to support non-Motorola Droid phones

- added 'Suspend' feature to turn off LED and pause battery status monitoring until resumed (un-checked)

- added strategy to make app more timely/responsive to SMS text notifications and preference/setting changes

- fixed set-on-boot and charging-color preference mis-match and other minor preference/settings issues (this was causing a few folks issues...if you still have an issue, try an un-install and fresh re-install--this will clear-out the saved preferences)

- supported amber LED color in addition to the original red/green/blue LED colors (for phones that support an amber LED color)

Anyway, this version should be much more stable and responsive than the prior versions (although v1.7 was pretty solid, :D).

Enjoy, and please visit https://sites.google.com/site/scaryalienware/battmonx for full details and screen shots. Shoot me an email at scary.alien@gmail.com for any issues, comments, questions, etc.

Cheers!
 

jason600

Senior Member
Nov 26, 2009
195
157
Nice app.

One small problem, running on a Milestone with CM6, every time I try to access the low battery settings, it force closes.

I've sent a crash log (using the report option when it force closes), hope it helps.
 
  • Like
Reactions: scary alien

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
Nice app.

One small problem, running on a Milestone with CM6, every time I try to access the low battery settings, it force closes.

I've sent a crash log (using the report option when it force closes), hope it helps.

Jason,

Thank you very much for both the feedback and the crash report (I'll take a look at it in a sec...).

You are my first Milestone user as far as I know...(cool!).

I don't have any idea what could be up wit the low-battery logic--there's nothing really special w/regard to that.... I'll get back with you as soon as I can.

Cheers!
 

scary alien

Inactive Recognized Developer
Jun 27, 2010
276
107
Indy
Nice app.

One small problem, running on a Milestone with CM6, every time I try to access the low battery settings, it force closes.

I've sent a crash log (using the report option when it force closes), hope it helps.

Jason,

I sent you a PM about the crash report--couldn't find anything that directly referenced my code, so I'm thinking that its related to the nested preference menus. Let me know about exactly what you were setting for the low-battery configuration (or if it was just launching or exiting the low-battery settings that caused the issue). If I have to, I'll move that menu option one level back/up and see if that helps (I can send you a test .apk if you are willing).

Cheers!
 

jason600

Senior Member
Nov 26, 2009
195
157
Thanks for the quick reply Scary Alien.

I go to preferences, click 'set led colours and action', then scroll to bottom, click 'low battery settings' and it immediately force quits.

I'll PM you me email for the .apk

Thanks
 
  • Like
Reactions: scary alien

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Nice app.

    One small problem, running on a Milestone with CM6, every time I try to access the low battery settings, it force closes.

    I've sent a crash log (using the report option when it force closes), hope it helps.
    1
    Thanks for the quick reply Scary Alien.

    I go to preferences, click 'set led colours and action', then scroll to bottom, click 'low battery settings' and it immediately force quits.

    I'll PM you me email for the .apk

    Thanks