1. Initialization and Status Change Processing

Guides you how to synchronize initialization and status change events(foreground<->background) in your game.

 


Definition of App Status Change Event

The status can change many times while a game app is running. While a game app is running, the user may tap the Home button to run the app in the background, then tap the game app icon again to move it to the foreground.

The Kakao Game SDK internally performs several actions according to the change in game app status (running, moved to background, or moved to foreground). These actions include terminating the heartbeats periodically sent to the platform server in order to prevent battery consumption when moving to the

The following APIs of the Kakao Game SDK must be called to process game status change:

Game App Status Change

Kakao Game SDK API

Game App Status Change

Kakao Game SDK API

Game Start

Start

Move to background

Pause

Move to foreground

Resume

 

Game Start (Start)

When a game is started, the SDK performs SDK initialization and "Start" status change through the Start API called by the game.

“Start” receives the basic information needed to start a game from the server based on some settings including game client version and then performs the actions of “Urgent announcement”, “Guide of testing”, “Guide of game client update”, “Guide of User’s Agreement” and “Automatic login” sequentially. Of course, “Automatic login” is performed only for users with a previous login record.

After this series of actions, the result of “Start” is sent to the game through the callback function inputted in the game when the Start API was called. The result of “Start” that is sent at this time is not related to authentication. In other words, a success is delivered even if automatic login had failed for some reason if the series of previous processes were successfully executed. The result of authentication is sent at the same time through a separate parameter.

Therefore, the game must regard a failure delivered by the Start API as a note that it is in a situation in which it cannot run, and try to call the Start API again or terminate the game. If the result of the Start API is a success, the game can decide whether to move to the main scene or to the login scene depending on the result of authentication sent at the same time.

Move to Background (Pause)

When the game is moved to the background, it calls the Pause API of the SDK to change the status to “Pause.”

"Pause" terminates the session connected to the platform server to prevent wasting the battery by minimizing network utilization.

Move to Foreground (Resume)

To move back to the foreground from the background, the game calls the Resume API of the SDK to change the status to “Resume.”

"Resume" restores the terminated session connection and performs a series of actions to maintain the authentication status.

If the server connection fails or the authentication details have expired, “Resume” delivers the failure through the callback function sent when the was API called. The game must retry “Resume” or move to the login scene to authenticate again depending on the cause of the failure indicated by the error code.