June 18th, 2012, 12:21 PM
|
#1 (permalink)
|
|
New Member
Thread Author (OP)
Join Date: Jun 2012
Posts: 1
Device(s):
Carrier: Not Provided
Thanks: 0
Thanked 0 Times in 0 Posts
|
BatteryManager
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?
|
|
|