preStartGameBySignature
Pre-start a Game (by Game Signature)
preStartGameBySignature is a launch pre-processing interface that combines the highest security level with ultimate loading performance. It locks a specific game version through a Game Signature and completes the entire process, from environment initialization to business logic execution, in the background in advance.
After using this interface, not only are the game resources ready, but its internal logic framework, network connections, and first-screen rendering instructions have all been processed in the background. When the user taps to launch, a "millisecond-level" screen transition can be achieved.
Method Declaration
java
/**
* Pre-start a game by game signature
*
* @param signature Game signature
* @param listener Pre-start status listener
* @return SUDOPGameTask Task handle, used to manage the pre-started game instance
*/
public static SUDOPGameTask preStartGameBySignature(
String signature,
SUDOPPreStartGameListener listener
);Parameters
| Field | Type | Description |
|---|---|---|
| signature | String | Required. A valid signature obtained through the getGameSignature interface. |
SUDOPPreStartGameListener
void onSuccess(String gameId, SUDRTGameHandleProvider provider): Pre-start completed. The game is in the "Running" logic state of the Activity lifecycle in the background, but with no physical view displayed.void onFailure(int retCode, String retMsg): Pre-start failed.
Runtime Behavior
- Version locking: By parsing the signature, the SDK ensures the pre-started game resource version is exactly consistent with the version at subsequent formal launch.
- Full logic activation: Unlike
preLoad, which only loads resources,preStartruns the game's script logic and can even trigger the game's network warm-up in advance (such as connecting to the game server). - Silent drawing: The game's first-screen render tree has been built in memory.
- Background suspension: Before receiving the formal launch command, the game instance stays running silently and automatically handles audio track muting.
Example Code
java
// 1. Set the pre-start parameters
String signature = "LATEST_GAME_SIGNATURE_FROM_SERVER";
// 2. Initiate pre-start
SUDOPGameTask task = SUDOP.preStartGameBySignature(signature, new SUDOPPreStartGameListener() {
@Override
public void onSuccess(String gameId, SUDRTGameHandleProvider provider) {
SUDRTGameHandle handle = provider.getGameHandle();
// Pre-start succeeded; the handle now holds the complete game running state
Log.i("SUDOP", "Game " + gameId + " is hot-started in background.");
}
@Override
public void onFailure(int retCode, String retMsg) {
Log.e("SUDOP", "Pre-start by signature failed: " + retMsg);
}
});
// If the user leaves the related scene, you must destroy the task to stop background logic execution
// task.destroy();Notes
- Resource occupation warning:
preStartproduces real CPU and memory load. Never perform this operation on memory-constrained devices, or on multiple games simultaneously. - Signature consistency: The signature used for pre-start must be consistent with the signature used at final
startGameByGameSignature; otherwise the pre-started instance may not be reusable. - Lifecycle synchronization: Be sure to listen for the host Activity's destruction event and call
task.destroy()in time, to avoid the game logic running continuously in the background causing battery drain or memory leaks.
The success callback returns SUDRTGameHandleProvider. Call provider.getGameHandle() to obtain the SUDRTGameHandle.
