Skip to main content

InitCustomer

AndroidiOSWindows
If you were looking for the method for use with Unreal Engine, see InitCustomer for Unreal Engine SDK.

Initializes the customer service. The asynchronous callback must be received before users call other APIs.

Function definition

public void InitCustomer(INTLCustomerUserProfile userProfile);

Input parameters

NameTypeDescription
userProfileINTLCustomerUserProfileCustomer service module request body, mainly including important input parameters such as language type and channel ID

CustomerUserProfile

Member variableTypeDescriptionRemarks
langTypestringSDK language. Specifies the language, which should follow the RFC 4646 standard, such as: en. For details, see Language Type DefinitionsRequired
signstringApp configurationRequired
openIdstringUnique user IDRequired
nickNamestringRole nicknameRequired
gameLevelstringGame levelOptional
roleIdstringRole ID, used to locate issues for customer serviceOptional
areaIdstringGame region ID, used to locate issues for customer serviceOptional
zoneIdstringGame zone ID, used to locate issues for customer serviceOptional
serverIdstringGame server ID, used to locate issues for customer serviceOptional
regionstringISO 3166-1 numeric code for country or region
For example 156 for China, 040 for Austria
Optional
pictureUrlstringAvatar linkOptional
customParam1stringuser tags, string of array, multiple tags are separated by ",", the default is an empty string, e.g: "recharge,suggestion"Optional
customParam2stringcustom data, json string, the default is an empty string, e.g: "{\"level\" : 34, \"total_recharge\" : 300}"Optional
customParam3stringSpare parameter which is not in useOptional
customParam4stringSpare parameter which is not in useOptional
customParam5stringSpare parameter which is not in useOptional
info
  • When any one of langType, sign, openId, and nickName of userProfile is empty, the "INVALID_ARGUMENT" error will be triggered and the client error code is 11.
  • When an HTML5 request fails, the "UNKNOWN" error will be triggered and the client error code is -1.

Callback Processing

The callback processing API is CustomerResultObserver.
The callback data structure is CustomerResult.

The callback methodID is INTL_CUSTOMER_INIT.

Code sample

var userProfile = new INTLCustomerUserProfile
{
LangType = "zh-Hans",
Sign = "YOUR_SIGN",
OpenId = "openid",
GameLevel = "1",
NickName = "player1",
RoleId = "",
AreaId = "",
ZoneId = "",
ServerId = "",
Region = "",
PictureUrl = "https://head.xxx.com/xx.png",
CustomParam1 = "recharge,suggestion",
CustomParam2 = "{\"level\" : 34, \"total_recharge\" : 300}"
};
INTLAPI.InitCustomer(userProfile);