Client ClientSDK API Reference
Client sdk api.
API List
| API | Description |
|---|---|
| InitSdk | Init modules for PGOS service. Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread. |
| InitConfig | Init config for PGOS service Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread. |
| GetConfig | Get configuration value of the specified key, except for "secret_key". |
| Tick | Tick for PGOS service which may dispatch PGOS events. Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread. NOte: In the PGOS Unreal Plugin, developers don't need to care about this interface and should not call it. |
| GetModule | Get specified PGOS service module object, it's an internal function. |
| OnAppEnterForeground | Should be called when the application enters the foreground. (for Android&iOS) |
| OnAppEnterBackground | Should be called when the application enters the background. (for Android&iOS). |
| GetSDKVersion | Get current PGOS SDK version. |
| Destroy | Shutdown PGOS service, should be called during process shutdown if possible. Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread. |
API Details
InitSdk
Init modules for PGOS service. Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread.
/**
* Init modules for PGOS service.
* Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread.
*
* @param params Request parameters for init sdk.
*/
void InitSdk(
const InitSdkParams& params);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const InitSdkParams& | Request parameters for init sdk. |
Return: void
InitConfig
Init config for PGOS service Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread.
/**
* Init config for PGOS service
* Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread.
*
* @param cfgs A configuration consisting of key/value pairs, such as "title_id", "secret_key", and others.
*/
void InitConfig(
const pgos::pmap<pgos::pstring, pgos::pstring>& cfgs);
Parameters:
| Param | Type | Description |
|---|---|---|
| cfgs | const std::map<std::string, std::string>& | A configuration consisting of key/value pairs, such as "title_id", "secret_key", and others. |
Return: void
GetConfig
Get configuration value of the specified key, except for "secret_key".
/**
* Get configuration value of the specified key, except for "secret_key".
*
* @param cfg_key The specified key, such as "title_id", "log_level", and others.
* @return The configuration value of the specified key.
*/
pgos::pstring GetConfig(
const pgos::pstring& cfg_key);
Parameters:
| Param | Type | Description |
|---|---|---|
| cfg_key | const std::string& | The specified key, such as "title_id", "log_level", and others. |
Return: pgos::pstring
The configuration value of the specified key.
Tick
Tick for PGOS service which may dispatch PGOS events. Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread. NOte: In the PGOS Unreal Plugin, developers don't need to care about this interface and should not call it.
Deprecated.
/**
* Tick for PGOS service which may dispatch PGOS events.
* Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread.
* NOte: In the PGOS Unreal Plugin, developers don't need to care about this interface and should not call it.
* [DEPRECATED!!!] Tick was declared deprecated.
*/
void Tick();
Parameters:
(No parameters)
Return: void
GetModule
Get specified PGOS service module object, it's an internal function.
/**
* Get specified PGOS service module object, it's an internal function.
*
* @param mod_id Specified PGOS service module object, such as ClientFakeAccount, ClientBattle, and others.
* @return service module object pointer.
*/
void* GetModule(
ModuleID mod_id);
Parameters:
| Param | Type | Description |
|---|---|---|
| mod_id | ModuleID | Specified PGOS service module object, such as ClientFakeAccount, ClientBattle, and others. |
Return: void*
service module object pointer.
OnAppEnterForeground
Should be called when the application enters the foreground. (for Android&iOS)
/**
* Should be called when the application enters the foreground. (for Android&iOS)
*/
void OnAppEnterForeground();
Parameters:
(No parameters)
Return: void
OnAppEnterBackground
Should be called when the application enters the background. (for Android&iOS).
/**
* Should be called when the application enters the background. (for Android&iOS).
*/
void OnAppEnterBackground();
Parameters:
(No parameters)
Return: void
GetSDKVersion
Get current PGOS SDK version.
/**
* Get current PGOS SDK version.
*
* @return PGOS SDK version string.
*/
pgos::pstring GetSDKVersion();
Parameters:
(No parameters)
Return: pgos::pstring
PGOS SDK version string.
Destroy
Shutdown PGOS service, should be called during process shutdown if possible. Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread.
/**
* Shutdown PGOS service, should be called during process shutdown if possible.
* Note: InitSdk/InitConfig/Tick/Destroy must be called on the main thread.
*/
void Destroy();
Parameters:
(No parameters)
Return: void