views:

31

answers:

1

Hello all,

A method which can be used for finding the battery percentage of your device is found here:

http://blog.coriolis.ch/2009/02/14/reading-the-battery-level-programmatically/comment-page-1/#comment-6085

I have tried it and it works great. If you have a closer look at the code there are two values curCapacity and maxCapacity. I want to be able to use these values in other calculations, yet when I try and do this I always get the error 'undeclared'.

Any ideas as to why?

+2  A: 

where are you trying to use this variables? they are declared inside - (double) batteryLevel method so you cannot use them in other methods. if you want to use them in other places, declare them in your .h file. so you will be able to get access to these values not only from this method.

Morion