Reputation: 455
I'm sure this has been asked before, but I can't seem to find it and I'm not sure how to rephrase it.
In IOS 9+ when the power gets low iOS gives you a prompt to optionally engage low power mode.
I'd like be able to pause the activity in my app when this alert is visible.
I'm sure there is a delegate method that I can use. Does anyone know the name of it?
Thanks!
Upvotes: 0
Views: 265
Reputation: 639
Or maybe you're just looking for
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
in your main AppDelegate.m This is called whenever any system popup is shown.
Upvotes: 1
Reputation: 125037
Watch for NSProcessInfoPowerStateDidChangeNotification
as described in React to Low Power Mode on iPhones. When you get that notification, check the state:
Once your app is notified of a power state change, it should then query isLowPowerModeEnabled to determine the current power state...
Your app can query the current power state at any time by accessing the isLowPowerModeEnabled property of the NSProcessInfo class, as shown in Listing 7-2. This property contains a boolean value, indicating whether Low Power Mode is enabled or disabled.
Upvotes: 3