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

Web and WebWorks Development

Reply
Contributor
Posts: 11
Registered: ‎12-14-2011
My Device: 9370
My Carrier: Verizon
Accepted Solution

Is there equivalent of getBatteryLevel() for Playbook?

I can see for Playbook there are callback functions that can be registered to discover when the battery level changes, but how do you find out the initial value of the battery level?

 

On BB handhelds, there appears to be a straightforward API DeviceInfo.getBatteryLevel().  Anything similar for Playbook?

 

 

 

 

Retired
Posts: 34
Registered: ‎10-24-2011
My Device: Curve
My Carrier: Telus

Re: Is there equivalent of getBatteryLevel() for Playbook?

The callback would be invoked with current battery level as a parameter when you call getBatteryLevel and later when battery level is changed.

This is exactly what you were up to if I properly understood you.

 



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Retired
Posts: 518
Registered: ‎07-18-2011
My Device: Bold
My Carrier: Rogers

Re: Is there equivalent of getBatteryLevel() for Playbook?

[ Edited ]

**EDITED**

 

Hi smccarthy,

 

Sergey is right, the callback will fire the first time with the current value.



1.Please resolve your thread by clicking the "Accept as Solution" button below the post which solved your problem!
2. If any post helps you please click the button below the post(s)
Contributor
Posts: 11
Registered: ‎12-14-2011
My Device: 9370
My Carrier: Verizon

Re: Is there equivalent of getBatteryLevel() for Playbook?

As far as I can see from the documentation, there is no getBatteryLevel() for Playbook.  

Contributor
Posts: 11
Registered: ‎12-14-2011
My Device: 9370
My Carrier: Verizon

Re: Is there equivalent of getBatteryLevel() for Playbook?

I understand better now.  

 

I was testing in the Ripple simulator, which doesn't call the battery level changed callback initially, though it does when I manually change the battery charge percentage  in the Device & Network Settings.

 

Pushing the app to the full VMWare simulator, I see that on page load that the callback is called with an initial value on page load.