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

Native Development

Reply
Developer
Developer
dnp
Posts: 28
Registered: ‎02-10-2012
My Device: playbook 4G/LTE
Accepted Solution

native code test for running on battery

is there a way for a native C app to test if running on battery or not?

 

i don't need levels. just battery/notbattery.

 

thanks.

 

 

Trusted Contributor
bdaemon
Posts: 152
Registered: ‎02-23-2011
My Device: dev alpha playbook 9500 8300

Re: native code test for running on battery

need  undocument method ,

 

there are already some battery & charger app in the appworld.

Developer
Developer
dnp
Posts: 28
Registered: ‎02-10-2012
My Device: playbook 4G/LTE

Re: native code test for running on battery

no love? :smileysad:

 

how about an implied way to determine if running on battery?

 

is there another feature in the system that changes properties between battery/non-battery

and can be determined from native C code?

 

Developer
borceg
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB

Re: native code test for running on battery

nothing about battery/charger/power in ndk docs. maybe accessing "/pps/services/power/" can help you ? it's dirty way, but it's the only thing in my mind right now
Developer
Developer
dnp
Posts: 28
Registered: ‎02-10-2012
My Device: playbook 4G/LTE

Re: native code test for running on battery

yup already using /pps/.../battery and .../charger

was hoping something more official existed since Java has it, HTML5/webworks has it, AIR has it...

but not 'native'....

something tells me that 'native' is really really not ready for prime time yet.

took me a couple days of figuring out which google terms to use to get eventually find /pps

 

such wasted time.

BlackBerry Development Advisor
elena_laskavaia
Posts: 417
Registered: ‎10-27-2010
My Device: PlayBook

Re: native code test for running on battery

access to /pps is not an API and cannot be guaranteed to persist or even work in future updates. Your app may stop at any point after sw upgrade if you using undocumented and unsupported APIs.
We working on native APIs as fast as we can in priority order.