HowTo: Check the Battery Level

From $1
    Table of contents

    Although there is a property In UIDevice called BatteryLevel that you can query, the value of this property is only valid if you first enable battery monitoring.

    Apple's documentation recommends that you do not turn on the battery monitoring unless you need to.   

    To do this, use this piece of code:

    float Report ()
    {
        UIDevice.CurrentDevice.BatteryMonitoringEnabled = true;
        return UIDevice.CurrentDevice.BatteryLevel;
    }

     

    Tag page
    • No tags

    Files (0)

     
    Page last modified 00:37, 22 Sep 2009 by Miguel