State transitions can be responded to state changes in an appropriate way by calling corresponding methods on the app’s delegate object.
For example :
* applicationDidBecomeActive( ) method
: To prepare to run as the foreground app
* applicationDidEnterBackground( ) method
: To execute some code when the app is running in the background that may be suspended at any time
* applicationWillEnterForeground( ) method
: To execute some code when the app is moving out of the background
* applicationWillTerminate( ) method
: Called when the app is being terminated