• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps BatteryManager

patherrod

Lurker
Hi,

I'm writing an application for the original galaxy tab that is running 2.3.6. One of the features of the application is to return battery data from the BatteryManager. I used the development tutorials, resources and references from the android development website. I'm have problems when determining when the tab is charging. I use this code:

int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL;

The problem is that the status variable always has a value of 4, which is public static final int BATTERY_STATUS_NOT_CHARGING
Since: API Level 1
Constant Value: 4 (0x00000004)

so no matter how the tab is plugged in, by ac or usb, or not plugged in, status = 4. Is this a firmware thing? Or a tab thing? Any ideas?
 
Back
Top Bottom