1) Why an app on iOS device behaves differently when running in foreground than in background?
An application behaves differently when running in foreground than in background because of the limitation of resources on iOS devices.
2)Which framework delivers event to custom object when app is in foreground?
The UIKit
infrastructure takes care of delivering events to custom objects. As an app
developer, you have to override methods in the appropriate objects to process
those events.
3)When an app is said to be in not
running state?
An app is said to be in 'not running' state when:
- it is not launched.
- it gets terminated by the system during running.
An app is said to be in 'not running' state when:
- it is not launched.
- it gets terminated by the system during running.
4)Assume that your app is running in the foreground but is currently not
receiving events. In which sate it would be in?
An app will be in InActive state if it is running in the foreground but is currently not receiving events. An app stays in InActive state only briefly as it transitions to a different state.
An app will be in InActive state if it is running in the foreground but is currently not receiving events. An app stays in InActive state only briefly as it transitions to a different state.
5)Give example scenarios when an application goes into InActive state?
An app can get into InActive state when the user locks the screen or the system prompts the user to respond to some event e.g. SMS message, incoming call etc.
An app can get into InActive state when the user locks the screen or the system prompts the user to respond to some event e.g. SMS message, incoming call etc.
6)When an app is said to be in active state?
An app is said to be in active state when it is running in foreground and is receiving events.
An app is said to be in active state when it is running in foreground and is receiving events.
7)Name the app sate which it reaches briefly on its way to being suspended.
An app enters background state briefly on its way to being suspended.
An app enters background state briefly on its way to being suspended.
8)Assume that an app is not in foreground but is still executing code. In
which state will it be in?
Background state.
Background state.
9)An app is loaded into memory but is not executing any code. In which state
will it be in?
An app is said to be in suspended state when it is still in memory but is not executing any code.
An app is said to be in suspended state when it is still in memory but is not executing any code.
10)Assume that system is running low on memory. What can system do for
suspended apps?
In case system is running low on memory, the system may purge suspended apps without notice.
In case system is running low on memory, the system may purge suspended apps without notice.
11)How can you respond to state transitions on your app?
On state transitions can be responded to state changes in an appropriate way by calling corresponding methods on app's delegate object.
On state transitions can be responded to state changes in an appropriate way by calling corresponding methods on app's delegate object.
For example:
applicationDidBecomeActive method can be used to prepare to run as the foreground app.
applicationDidEnterBackground method can be used to execute some code when app is running in the background and may be suspended at any time.
applicationWillEnterForeground method can be used to execute some code when your app is moving out of the background
applicationWillTerminate method is called when your app is being terminated.
12) List down app's state transitions when it gets launched? applicationDidBecomeActive method can be used to prepare to run as the foreground app.
applicationDidEnterBackground method can be used to execute some code when app is running in the background and may be suspended at any time.
applicationWillEnterForeground method can be used to execute some code when your app is moving out of the background
applicationWillTerminate method is called when your app is being terminated.
Before the launch of an app, it is said to be in not running state.
When an app is launched, it moves to the active or background state, after transitioning briefly through the inactive state.
13)What are the App states? Explain them?
Not running State: The app has not been launched or
was running but was terminated by the system.
Inactive state: The app is running in the foreground but is
currently not receiving events. (It may be executing other code though.) An app
usually stays in this state only briefly as it transitions to a different
state. The only time it stays inactive for any period of time is when the user
locks the screen or the system prompts the user to respond to some event, such
as an incoming phone call or SMS message.
Active state: The app is running in the foreground and is
receiving events. This is the normal mode for foreground apps.
Background state: The app is in the background and executing
code. Most apps enter this state briefly on their way to being suspended.
However, an app that requests extra execution time may remain in this state for
a period of time. In addition, an app being launched directly into the
background enters this state instead of the inactive state. For information
about how to execute code while in the background, see “Background Execution
and Multitasking.”
Suspended state: The app is in the background but is not
executing code. The system moves apps to this state automatically and does not
notify them before doing so. While suspended, an app remains in memory but does
not execute any code. When a low-memory condition occurs, the system may purge
suspended apps without notice to make more space for the foreground app.
Hey! This blog is more informative and user friendly
ReplyDeleteThank you so much for giving this information to me..
best organic face cream
best shampoo for hair fall control and dandruff