I have a GPS app that already uses a fair amount of battery. Because of the nature of the app, I don't want the user to loose all of their data if their battery dies without them knowing it. So, I figured I would monitor the battery and then save and stop the GPS data if the battery is very low. I would use:
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(batteryStateDidChange:)
name:UIDeviceBatteryStateDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(batteryLevelDidChange:)
name:UIDeviceBatteryLevelDidChangeNotification
object:nil];
So, a few questions:
- Would monitoring the battery cause even MORE battery drain?
- Is it a good idea to auto-save (core-data) for the user right before the battery dies?