I have message on my device, and it says the following:
Battery is low. Charging current not enough for device power consumption. Please switch to AC adapter.
Is there any intent fired before this message is shown?
And how do they calculate if this message will be shown or not?
And the thing I do not understand is how the power supply is not enough?
It is so weird -- my phone is plugged in to my PC, and instead of being charged, the battery goes empty
NOTE: The message is shown only in the case where the device is plugged in to a USB port of the PC.
I had an htc desire for a year, and this message was never shown; but now with the sensation this message occurs very often.
Does anyone know how can I catch this intent -- if it is fired at all?
Some devices (tablets?) consume more power than what can be provided via USB port.
You could try to detect this by detecting both
BatteryManager.BATTERY_PLUGGED_USB
andBATTERY_STATUS_DISCHARGING
.Battery low can be detected by registering to
ACTION_BATTERY_LOW
broadcast.As far as I know there is no explicit intent.You can try and listen for the sticky
BATTERY_CHANGED
broadcast intent. This should contain at least theBATTERY_PLUGGED_USB
info from theBatteryManager
, probably in combination withBATTERY_STATUS_DISCHARGING
.This happens because the usb-ports of a computer have a limited current, for USB 2.0 ports its either 500 mA (Hi-power) or 100 mA (low-power¹). Thats not enough to power a device with a big screen and a decent cpu along other hardware (e.g. GPS is expensive currentwise). The normal, dedicated chargers usually provide around 1000 mA (1A).
This occurs with the sensation more often (it happens with my desire also sometimes) since it has a bigger screen (4.3" vs 3.7" of the desire) and a faster CPU. The screen is also a LCD, some of the Desire models have an OLED display instead (maybe you got one of these). This OLED drains way less battery while displaying dark, blueish content. If you got a lot of white/towards red content instead, the LCD consumes less (when comparing similar sizes of course) - so this might also be a factor.
You can try to avoid this message by turning off the screen and sending the device to standby for a few minutes. This should charge it at least a bit, since the power consumption is way smaller.
¹ Low power: That's the case when you have your device on an usb-hub without it's own dedicated power supply.