Messages are used by the operating system to facilitate that transition of foreground state to background state and also from background state to foreground state.
System messages are used to make requests to an application. During the application lifecycle, your application may receive a transition system message that tell your application to transition from the foreground to the background, or from the background to the foreground.
The system provides a message queue to read and process these message:
OSMessageQueue * OSGetSystemMessageQueue(void);
Messages use the following structure.
data0 member of a message holds a code describing the purpose of the message.
Transition messages can be of the following values:
The above are short forms of these messages. For example, a complete test for a
RELEASE_FOREGROUND message would look like similar to the following.
msg.data0 == OS_SYSTEM_MESSAGE_DATA0_RELEASE_FOREGROUND