Skip to main content

Initialization (InitLI)

AndroidiOSWindows
Deprecated: LI PASS V1.16.00
If you're using the Unity engine, see InitLI for the Unity SDK.

It is recommended to initialize LI PASS at game launch.For LI PASS V1.16.00 and later versions, please call InitLIP.

Function Definition

UFUNCTION(BlueprintCallable, Category = "LevelInfinite")
static int InitLI(UGameInstance* instance, bool isTest, const FString& appVersion, const FString& langType = "en");

Initialize LI PASS through the following steps:

  1. Retrieve hotfix version information
  2. Download the new version of resources
  3. Load resources
  4. Once loading is complete, the LI PASS event callback (LIEventObserver) triggers the GN_READY event.
note

When a network exception occurs, the callback timeout feedback for the GN_READY event is 60s*3.After initialization, the game can directly call AutoLogin, OpenLoginPanel, or LoginChannelWithLIPass to provide timely response to players without waiting for the GN_READY event.

Retrieve hotfix version information

Request Info

You can search for gnconfig to locate the request URL:

2023-06-08 09:54:20.948 25151-26800 INTL                    com.intlgame.demo                    I  [INTL][1806][A.I.A][2023-06-08 09:54:20.948][25151, 26800, 539607522480][ (intl_http_manager.cpp:328) OnHTTPClientCallBack]: 
[http] request url: https://test-vas.intlgame.com/v2/gnconfig/acquire_config?area_id=0&channelid=131&gameid=11&openid=FFFFFFFFFFFFFF&os=1&sdk_version=1.3.00&seq=11-7a08fc1d06ea8e62b6ea3e626ed61c8f2398c981bc6d8d0dfa30681a3d05616e-1686189260-717&source=37&token=&ts=1686189260&sig=6dc2bb8968cfe28fab5138e2342f327d,

Response Info

caution

If LI PASS does not perform as expected, please check the hot update version information to ensure the correct resources are running.

If a match to the rule is found, you can search for rule_id to locate the response information:

response_body: {
"ret":0,
"msg":"",
"rule_id":"1063",
"resource_list":"[{\"dependency\":[],\"file_list\":[{\"md5\":\"968F1A3E16AB6041F504E29DEFB348DD\",\"size\":1747648,\"url\":\"https://sg-gamenative001-1300342648.file.myqcloud.com/gamenative-files/11/LI_107_UE_Android/1686187421509627102/LevelInfinite_Android.pak\"}],\"is_public\":0,\"name\":\"LI_107_UE_Android\"}]",
"sdk_enable":1,
"sdk_debug_enable":1,
"report_log_enable":1,
"log_level":1,
"inner_seq":"ac097e19-772b-4069-948d-78e21821ac15",
"seq":"11-7a08fc1d06ea8e62b6ea3e626ed61c8f2398c981bc6d8d0dfa30681a3d05616e-1686189260-717"
}

If no match to the rule is found:

response_body: {
"ret":23111202,
"msg":"no matched config error( [match logic]no match )",
"rule_id":"",
"resource_list":"",
"sdk_enable":0,
"sdk_debug_enable":0,
"report_log_enable":0,
"log_level":0,
"inner_seq":"ca3fa94a-0be7-4325-aa90-a5bc36d7c502",
"seq":"11-7a08fc1d06ea8e62b6ea3e626ed61c8f2398c981bc6d8d0dfa30681a3d05616e-1686189018-705"
}

Input Parameters

ParametersTypeDescription
instanceUGameInstanceUE GameInstance
isTestbooleanIs it a test environment? false for a production environment, true for a test environment.
appVersionStringGame version number, cannot contain spaces.
langTypeStringLI PASS UI display language

Code example

FString Version = FApp::GetBuildVersion();
ULevelInfiniteAPI::InitLI(GetGameInstance<UGameInstance>(), true, Version, TEXT("en"));