ASBatteryMonitor 0.1.0

ASBatteryMonitor 0.1.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by ruddfawcett.



  • By
  • Rudd Fawcett

Podfile, Full AmbientStatus

platform :ios, '7.0'
pod "AmbientStatus", "~> 0.1.0"

Podfile, Just ASBatteryMonitor:

platform :ios, '7.0'
pod "AmbientStatus/ASBatteryMonitor"

Usage

First, add the <ASBatteryMonitorDelegate> to whichever file you'd like to use it in.

After you have done so, you have to startMonitoring the user's battery:

ASBatteryMonitor *batteryMonitor = [ASBatteryMonitor sharedInstance]; // create new instance
batteryMonitor.delegate = self; // assign the delegate to self

[batteryMonitor startMonitoring]; // start monitoring the user's battery

After you have created a new sharedInstance of ASBatteryMonitor, and have set the delegate, you can implement the following optional delegates if you desire:

- (void)batteryMonitor:(ASBatteryMonitor *)batteryMonitor didChangeBatteryState:(UIDeviceBatteryState)state {
    // Do something with the new battery state here
}
- (void)batteryMonitor:(ASBatteryMonitor *)batteryMonitor didChangeBatteryLevel:(CGFloat)level {
    // Do something with the new battery percentage here
}

For more help, see the documentation.

Credits

Developed by Rudd Fawcett. You can find all of his open source projects on GitHub.

Questions?

Open an issue. I'll try get back to you within 24 hours.

License

AmbientStatus and ASBatteryMonitor are available under the MIT license. See the LICENSE file for more info.