getGameList
Get Game List
The getGameList method retrieves a paginated game list and returns pagination information and game records through a callback.
The overload with selectionId retrieves games in a specific selection. Obtain selection IDs using getSelectionList.
For category queries, use getGameListByCategory and getCategories.
Prerequisites
Before calling getGameList, you must call SUDOP.initSDK and wait for initialization to succeed.
Method Declaration
/**
* Get the game list
*
* @param params Optional pagination and language parameters
* @param callback Callback listener
*/
public static void getGameList(SUDOPGameListParams params, SUDOPGameListCallback callback);
public static void getGameList(String selectionId, SUDOPGameListParams params,
SUDOPGameListCallback callback);Both methods use the same pagination parameters, callback, and response models.
Parameters
| Parameter | Type | Description |
|---|---|---|
| selectionId | String | Required when querying a specific selection. Must not be empty. |
| params | SUDOPGameListParams | Optional pagination and language parameters. Fields are described below. |
| callback | SUDOPGameListCallback | Callback listener that receives the game list retrieval result. |
SUDOPGameListParams
| Field | Type | Default | Description |
|---|---|---|---|
| pageNo | int | 0 | Zero-based page number. Values below 0 are treated as 0. |
| pageSize | int | 10 | Records per page. Values less than or equal to 0 are treated as 10. |
| language | String | null | Optional language for retrieving the game list. Use a BCP 47 language tag, such as zh-CN or en-US. |
Leave language as null to retrieve the list without specifying a language. The returned gameName and icon fields remain multilingual maps; select the value to display in your app.
Pass params = null to use the default pagination without specifying a language.
Result Callback
public interface SUDOPGameListCallback {
void onSuccess(SUDOPGameListResult result);
void onFailure(int retCode, String retMsg);
}| Method | Parameter | Type | Description |
|---|---|---|---|
| onSuccess | result | SUDOPGameListResult | The paginated result returned on success. |
| onFailure | retCode | int | The error code returned on failure. |
| onFailure | retMsg | String | The error description returned on failure. |
Response Model: SUDOPGameListResult
| Field | Type | Description |
|---|---|---|
| pageNo | int | Current page number, starting from 0. |
| pageSize | int | Number of records per page. |
| total | int | Total number of records. |
| records | List<SUDOPGameListItem> | The game list for the current page. |
SUDOPGameListItem
| Field | Type | Description |
|---|---|---|
| gameId | String | Game ID. |
| gameName | Map<String, String> | Game names in multiple languages. Each key is a language tag, and its value is the game name in that language. |
| gameIcon | String | Legacy game icon URL, available as a fallback. |
| icon | Map<String, String> | Game icon URLs in multiple languages, using the same map structure as gameName. |
| version | String | Game version number. |
For gameName and icon, language tags such as zh-CN and en-US map to localized values; default identifies the default value. These fields remain maps in the callback, so the caller selects the value to display.
Example Code
Original Game List
Run the following code after SUDOP.initSDK initialization succeeds.
SUDOPGameListParams params = new SUDOPGameListParams();
params.pageNo = 0;
params.pageSize = 20;
String language = "zh-CN";
params.language = language;
SUDOP.getGameList(params, new SUDOPGameListCallback() {
@Override
public void onSuccess(SUDOPGameListResult result) {
Log.i("SUDOP", "Current page: " + result.pageNo + ", Total records: " + result.total);
for (SUDOPGameListItem item : result.records) {
Log.i("SUDOP", "Game ID: " + item.gameId + ", Version: " + item.version);
}
}
@Override
public void onFailure(int retCode, String retMsg) {
Log.e("SUDOP", "Failed to get game list: " + retCode + ", " + retMsg);
}
});Pass your app's selected BCP 47 language tag, using the same value as getGameInformation.
Games in a Selection
Call after SDK initialization succeeds and replace the example ID with an actual selection ID. This query does not require user authentication.
String selectionId = "123"; // Replace with an actual selection ID
SUDOPGameListParams params = new SUDOPGameListParams();
params.language = "en-US";
SUDOP.getGameList(selectionId, params, new SUDOPGameListCallback() {
@Override
public void onSuccess(SUDOPGameListResult result) {
Log.i("SUDOP", "Games in this selection: " + result.total);
}
@Override
public void onFailure(int retCode, String retMsg) {
Log.e("SUDOP", "Failed to get selection games: " + retCode + ", " + retMsg);
}
});