Graphics Programs Reference
In-Depth Information
While in the active state, an application can be temporarily interrupted by a system event
like an SMS message, push notification, phone call, or alarm. An overlay will appear on
top of your application to handle this event. This state is known as the inactive state . In
the inactive state, an application is mostly visible (an alert view will appear and obscure
part of the interface) and is executing code, but it is not receiving events. Applications
typically spend very little time in the inactive state. You can force an active application in-
to the inactive state by pressing the lock button at the top of the device. The application
will stay inactive until the device is unlocked.
When the user presses the home button or switches to another application in some other
way, the application enters the background state . (Actually, it spends a brief moment in
the inactive state before transitioning to the background.) In the background, an applica-
tion's interface is not visible or receiving events, but it can still execute code. By default,
an application that enters the background state has five seconds before it enters the sus-
pended state .
An application in the suspended state cannot execute code, you cannot see its interface,
and any resources it doesn't need while suspended are destroyed. A suspended application
is essentially freeze-dried and can be quickly thawed when the user relaunches it. The re-
sources that are destroyed are ones that can be reloaded, like cached images, system-man-
aged caches, and other graphics data. (You don't have to worry about destroying and re-
loading these resources; your application handles it automatically.) Table 14.1 summarizes
the characteristics of the different application states.
Table 14.1 Application states
State Visible Receives Events Executes Code
Not Running No
No
No
Active
Yes
Yes
Yes
Inactive
Mostly No
Yes
Background No
No
Yes
Suspended
No
No
No
You can see what applications are in the background or suspended by double-clicking the
home button on your device. (Recently run applications that have been terminated may
also appear in this list.)
Figure 14.6 Background and suspended applications in the dock
 
Search WWH ::




Custom Search