Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
johnbibs
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Battery Level

Hi,

 

Anybody knows the equivalent percentage of the DeviceInfo.BSTAT_* of the battery levels? I need to know the hierarchy of the different levels. Because i need to know for example, if the battery level = BSTAT_LOW, can it still send data? etc....

 

Thanks! 

Please use plain text.
Developer
johnbibs
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Battery Level

up
Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Battery Level

Just a guess, print thier intger values and try relating them to the percentage... not sure it comes in order.

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
johnbibs
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Battery Level

yeah i tried that already but can't interpret it correctly. :smileyhappy:)

 

anyway here are the values:

 

BSTAT_AC_CONTACTS: 16

 

BSTAT_CHARGING: 1

 

BSTAT_DEAD: -2147483648

 

BSTAT_IS_USING_EXTERNAL_POWER: 4

 

BSTAT_LEVEL_CHANGED: 2

 

BSTAT_LOW: 268435456

 

BSTAT_LOW_RATE_CHARGING: 8

 

BSTAT_NONE: 8388608

 

BSTAT_NO_CAMERA_FLASH:8192

 

BSTAT_NO_RADIO: 16384

 

BSTAT_NO_TURN_ON: 32768

 

BSTAT_NO_WLAN: 4096

 

BSTAT_REVERSED: 4194304

 

BSTAT_TOO_COLD: 1073741824

 

BSTAT_TOO_HOT: 536870912

 

INVALID_DEVICE_ID: -1

 

BSTAT_AC_CONTACTS: 16 

 

 

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Battery Level

BSTAT_NO_CAMERA_FLASH:8192

 

BSTAT_NO_RADIO: 16384

 

BSTAT_NO_TURN_ON: 32768

 

The above 3 has a relation.. will those help you?


Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
johnbibs
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Battery Level

Thanks! would you know if those 3 comes first before encountering BSTAT_LOW? or even BSTAT_NO_RADIO?
Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Battery Level

Never tried :-( you need to give your testing results here.

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
sahil_khanna
Posts: 112
Registered: ‎07-19-2009
My Device: Not Specified

Re: Battery Level

DeviceInfo.getBatteryLevel();
Please use plain text.
Administrator
MSohm
Posts: 14,268
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Battery Level

Note that you can simulate different battery levels in the BlackBerry smartphone simulator.  Select Battery Properties in the Simulator menu to adjust this.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
tiandi79
Posts: 110
Registered: ‎10-22-2009
My Device: 9700
My Carrier: ChinaMobile

Re: Battery Level

[ Edited ]

public void batteryStatusChange(int status)

Invoked when the internal battery state has changed.

 

Parameters:

 

status - A combination of the BSTAT_xxx masks

 

For example,

public void batteryStatusChange(int status) {
    //when status is 5. I think it is BSTAT_CHARGING: 1 + BSTAT_IS_USING_EXTERNAL_POWER: 4,do I think right? 
    //So the below code is never matched 
    if (status == DeviceInfo.BSTAT_CHARGING) 
        System.out.println("In charing!"); 
}

 So how to detect device charging correctly?

Best Regards,
Tiandi
www.tiandiyoyo.com
Please use plain text.