Background State


If you have processed a request to move to the background, your game is not seen by the user, and another process (system or game) is running in the foreground. Your application is considered to be running in a background state.


A background process has no access to foreground resources. For information on the resources that the foreground process has access to, see Foreground Resources.

A background process does have access to a limited set of resources. For more information about resources that are available to background processes, see Background Resources.

OS timers

OS timers on Core 2 function as expected. However, if OS timers fire on Cores 0 and 1 while in the game is in background, those timers fire immediately after the game returns to the foreground. Ensure that the game does not rely on timers firing on Cores 0 and 1 when it is in the background.

Cafe SDK provides a library of functions that help a game acquire and relinquish UI devices when switching between foreground and background modes.

Determining Foreground and Background

You can use the OSGetForegroundBucket function to determine whether your application is running in the background. If a process calls this function while it is in the background, an error code is returned and a NULL value is reported for the bucket address. For a process to test if it is in the foreground, it need only call this function with benign arguments and check the error code.

Network Usage While In the Background

While the game is in the background, the foreground process may start or stop using the network. The game receives notification that foreground network operations are starting or stopping. This is a large-scale granularity message and does not get sent on every network transaction. The game can use this information to throttle or change its assumptions about network bandwidth while in the background.

When not using ProcUI, the game receives a OS_SYSTEM_MESSAGE_DATA0_NETIO_CHANGE message in the system message queue that has a data1 parameter that is set to nonzero if network operations are beginning in the foreground process, and set to zero if operations are stopped.

When using ProcUI, ProcUI receives PROCUI_MESSAGE_NETIO_START and PROCUI_MESSAGE_NETIO_STOP and calls the appropriate callbacks.

Although the callbacks can be set to any core, they will all be called from Core 2.

For more information on the ProcUI Library, see the ProcUI Library.

See Also

Create an Application
Application Concepts
Application Lifecycle
Foreground State
Request to Move to the Background
Request to Move to the Foreground
Transition Messages
Multicore Processing

Revision History

2013/08/08 Created