Skip to content

uninitSDK ​

Uninitialize the SDK ​

The uninitSDK method releases all system resources occupied by the SDK. Calling it destroys the current runtime environment (Runtime), disconnects all network connections, and clears internal cache state.

Uninitialization clears the authentication invalidation listener. Register it again after reinitialization.


Method Declaration ​

java
/**
 * Uninitialize the SDK
 *
 * @param listener Listener that receives the uninitialization completion status
 */
public static void uninitSDK(SUDOPUninitSDKListener listener);

Parameters ​

1. SUDOPUninitSDKListener ​

Callback interface that receives the operation result:

  • void onSuccess(): The SDK has successfully released all resources and fully exited.
  • void onFailure(int retCode, String retMsg): An exception occurred during uninitialization.

Runtime Behavior ​

  1. Instance destruction: Automatically stops all running game instances and destroys the global Runtime container.
  2. Connection teardown: Closes the long-lived connections held internally by the SDK and any pending network requests.
  3. Memory release: Unloads the script engine core and releases the system memory occupied by the underlying C++ modules.

Example Code ​

java
// Call this when exiting the App or fully cleaning up the SDK
SUDOP.uninitSDK(new SUDOPUninitSDKListener() {
    @Override
    public void onSuccess() {
        // SDK uninitialized successfully
        Log.i("SUDOP", "SDK uninitialized successfully.");
    }

    @Override
    public void onFailure(int retCode, String retMsg) {
        // Uninitialization failed
        Log.e("SUDOP", "SDK uninit failed: " + retMsg);
    }
});

Notes ​

  • Call with caution: This is a heavyweight operation. Unless the user fully exits the App or you are certain the game features will not be used for a long time, calling it frequently is not recommended.
  • Restart flow: After calling uninitSDK, if you need to use the SDK again, you must restart from the initSDK flow.
  • Safe exit: Before calling this method, make sure your business logic has properly saved the user's data.