Detect power source (usb/ac)
Add a choice to select usb or ac power source.
This is completed with the Locale Power Source Plug-in (thanks Chris!), which is available for free on the Android Market.
13 comments
-
cdoerman77
commented
Unfortunately, Chris's plug-in does not work reliably on my Moto Droid. I wish it did but it doesn't detect power properly if the phone is plugged in and rebooted. It also doesn't work correctly if the phone is at 100% charge. I hope this will be fixed at some point.
-
Chris Boyle
commented
@Carter: Done, thanks.
-
AdminCarter
(Admin, two forty four a.m.)
commented
@chris: Please consider updating the Android Market description to contain the words "Locale plug-in" so that users will be able to find your plug-in more easily from the Get Plug-ins menu item.
-
Chris Boyle
commented
Edit: I've written a plugin to detect this: http://chris.boyle.name/projects/pslp
Detects whether you're on "battery", "AC/dock", "USB". Can't be more specific than that with current public APIs, except by combining with someone else's dock plugin.
API for this is in android.os.BatteryManager: from API level 5 (Android 2.0), ACTION_BATTERY_CHANGED (sticky, requires registerReceiver) will contain BatteryManager.EXTRA_PLUGGED = BatteryManager.BATTERY_PLUGGED_{AC,USB}. If I can suggest a UI: in the edit activity for a battery condition, when "plugged in" is selected, a label "Power source" and another Spinner should appear below, three possible values: "Don't care" (the default), "AC", "USB".
This feature would be a good workaround for those too cheap/impatient to buy Google's car dock: I generally charge from a computer, except when I'm in the car. So I'd set this to AC and there's my "driving" condition.
-
Rahul Parmar
commented
Not sure if this is even possible, but if Locale could differentiate between an 120v a/c charger and a 24v car charger that would take it to the next level. (then one could enable GPS on in a car vs enabling WiFi on at home!)
-
aaron.w2
commented
This would be nice so I could change the display timeout when it is AC powered.
-
jonozriley
commented
Definitely should have the option to distinguish between USB and AC chargers. Working on my computer is a very different thing than plugging it in at night.
-
Steven Rothkin commented
I would like to set the Droid to turn alarm/notification volume to full when it is plugged into power (implying it is not in my holster) during non-sleeping hours. With that setting I would then have my default set to always be vibrate only (and would not have to worry about setting up specific locations where volume should be muted).
-
Ipsquiggle
commented
Whoops, I see that what I was thinking is already there. Thanks. :)
-
Ipsquiggle
commented
Or even more generally: just using this to turn radios/brightness up to max when the phone is plugged in and battery is not an issue.
-
3shirts
commented
Yeah, I have a battery widget which shows an icon based on which source is charging it so I assume there is something in Android which 'knows' this information. Would be handy as I charge from mains at home but USB at work.
-
metis
commented
Therein lies the rub.
-
markgoho
commented
There is actually already a trigger based on power supply and battery %. The only thing it doesn't differentiate between is USB and A/C power.