How can I detect that an app has just returned from \"background mode\"? I mean, I don\'t want my app to fetch data (each 60 sec) when the user press the \"home button\". Bu
If you implement a UIApplicationDelegate, you can also hook into functions as part of the delegate:
- (void)applicationDidEnterBackground:(UIApplication *)application {
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
NSLog(@"Application moving to background");
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of the transition from the background to the active state: here you can undo many of the changes made on entering the background.
*/
NSLog(@"Application going active");
}
For the protocol reference see http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html