Skip to content

LcmCoreAndroid

LCM Core Android

LCMSDK

Package : com.denachina.lcm.sdk
Class : LCMSDK

Interface / Method
Parameters details
Note

public static void init (

 Activity activity,

 EventHandler eventHandler

 )

activity
Sets the host activity to do this method.

 eventHandler
Sets the instance that implement EventHandler interface.
If SDK need to inform SDK's events, SDK call methods of the interface.
About "EventHandler" detail, please see here.
Game developer has to call the method in "onCreate()" method of host activity.
SDK keeps EventHandler instance into LCDSDK instance for sending SDK event notification any time.

public static void resume (

 Activity activity

 )

activity
Sets the host activity to do this method.
Game developer has to call the method in "onResume()" method of host activity.

 In the method, SDK tries to get/update access token from LCD server. And, SDK does the following things in the first call of this method.
  • Checking the app configuration. ("assets/lcm.json" file)
  • Getting some device identifier (Advertising id and others.)
  • Getting device token of remote notification
  • Getting In-App-Billing products, and populating it on memory for quick loading in purchase process.
 About detail flow to get/update token, please see here.

 Also, SDK starts the timer of a task to update access token.

public static void pause (

 Activity activity

 )

activity
Sets the host activity to do this method.
Game developer has to call the method in "onPause()" method of host activity.

 In the method, SDK tries to update access token if the token is in the app.

 About detail flow to update token, please see here.

  And, SDK stops the timer of a task to update access token.

public static User getCurrentUser ()

 

Gets the User object of the current session.

The current user's LCM data

public static void getAllUserIds (

Activity activity,

OnGetAllUserIdsComplete onGetAllUserIdsComplete

)

activity

Sets the host activity to do this method.

onGetAllUserIdsComplete

Callback of the getAllUserIds.
Get all UserId on the device.

public static void getAccessToken ()

 

Gets the access token of the current session.

Access The user's LCM access token, or null if the current session is invalid

public static String getSDKVersion ()

 

Gets the current version of the installed LCM SDK

The version number as String

public static boolean isSandbox ()

 

Determines if your application is connecting to LCM's "sandbox" or "production" environment

Your application can specify which environment to use through the "conf/appinfo.json" settings file.

public static void resetUser(

Activity activity,

OnResetUserComplete onResetUserComplete

)

activity

Sets the host activity to do this method.

onResetUserComplete

Callback of the resetUser.

 Reset user and get a new user.

NOTE:CP need to prevent users multi-clicking the button at the same time.

public static void switchUser(

Activity activity,

String userId;

OnSwitchUserComplete onSwitchUserComplete

)

activity

Sets the host activity to do this method.

userId

The userId to be switched.

onSwitchUserComplete

Callback of the switchUser.
Switch the current user.

public static void onActivityResult(

int requestCode,

int resultCode,

Intent data

requestCode

The same as the RequestCode return Android API onActivityResult.

resultCode

The same as the ReusltCode return Android API onActivityResult.

data

The same as the data return Android API onActivityResult.
Game developer has to call the method in "onActivityResult" method of host activity.

public static void onNewIntent(

Activity activity,

Intent intent

activity

Sets the host activity to do this method.

intent

From the Android API onNewIntent.
 Game developer has to call the method in "onNewIntent" method of host activity.
 

public static void onDestroy(

Activity activity

 

activity

Sets the host activity to do this method.
 Game developer has to call the method in "onDestroy" method of host activity.

public static void

shouldBlockResume(

boolean blockResume

)

 blockResume
If blockResume is TRUE, resume will do nothing.If FALSE, resume will updateSession|createSession.
 Developer must call this function in Upgrade|Announcement callback to ensure the case that user switch the app to the background and front,the upgrade function behave right.

public static void setAuthCode (

String authCode

)

 authCode
If authCode is not null , it will be used as a auth parameter.
Developer should call setAuthCode in EventHandler onActivation.

public static boolean isFirstToLinkOrLoad ()

 Use this flag to decide whether link or load function should be done first.
public static String getAffcode () Get affcode of the game
public static void logout() If logout complete, onLogoutComplete will be called in event handler.
public static void checkAnnouncement() 

Check whether announcement is exist.

if exist, onAnnouncement will be called in event handler.

public static void setExtra(

String event,

String detail

)

event

Such as createRole.

detail

Detail information of the event in json.

Upload extra event to server.

Event ex: @"createRole"

Detail ex: {"roleId":"123","roleName":"Eleric","server":"Booty Bay"}

public static void recover(

Activity activity,

List<VCBundle> vcBundles

)

activity

activity

vcBundles

List of all VCBundles.

This will recover the L balance while user have transactions that do not get L coin.

If any transaction is recovered,

the next time Wallet getBalance is called, L coin will be added.

public static void showMenubar(Activity activity)

activity

activity
Show menubar in the default postion, left-top

public static void showMenubar(Activity activity, int postion)

activity

activity

postion

menubar postion

 Show menubar in the specified postion

postion:

0: left-top

1: right-top

2: left-bottom

3: right-bottom

 public static void hideMenubar(Activity activity)

activity

activity
 hide the menubar

public static void onConfigurationChanged(Activity activity, Configuration newConfig)

activity

activity

newConfig

new configuration
 Game developer has to call the method in "onConfigurationChanged" method of host activity.
public static void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)

requestCode

The same as the requestCode return Android API onRequestPermissionsResult.

permissions

the same as the permissions return Android API onRequestPermissionsResult

grantResults

the same as the grantResults return Android API onRequestPermissionsResult
 when targetSdkVersion=23, Game developer has to call this method in "onRequestPermissionsResult" method of host activity.
public static void login() Do login function. onLoginComplete in EventHandler will be the callback.
public static void registerPermissions(Activity activity, Map<String, Boolean> permissionsMap, OnRegisterPermissionListener onRegiesterPermissionListener)

activity

activity

permissionsMap

the permission which game need to do request for.
the key is permission, the value is true or false to show if it is needed.

onRegiesterPermissionListener

when register permisson finished, it will be callback

CP needs to invoke the method when the game starts and the LCMSDK.init() & other initialize methods that game itself need should be invoked in the callback onRegiesterPermissionListener

 

public static void additionalFunction(Activity activity, LCMAdditionalFunction additional)

activity

activity

additional

the operation

The CP can call this method to perform additional operations. For example CP can call LCMSDK.additionalFunction(activity, LCMSDK.LCMAdditionalFunction.STORE_ACCOUNT_MANAGER) to open user center.

LCMSDK.LCMAdditionalFunction enums: { STORE_ACCOUNT_MANAGER }

 

public static boolean isUserNeedRealNameRegister(Activity activity)

activity

activity

CP must call this method to check if the current user need to register Real Name.

If returns true, the current user need to register real name,

if returns false,do not.

public static void doRealNameAuth(Activity activity, final OnRealNameListener callback)

activity

activity

callback

when register real name complete,it will call back.

When CP gets that the current user need to register real name, CP should call this method to register real name.

The current registers completely, CP will get the callback, and CP can do different things according to the result.

LCMSDK.OnRegisterPermissionListener

Package : com.denachina.lcm.sdk
Interface : LCMSDK.OnRegisterPermissionListener

Interface / Method
Parameters details

public void onRegisterPermissionsComplete (

 String... permissionsDenied

 )

permissionsDenied
permissions that be rejected by user and non-essential permissions.

 

LCMSDK.EventHandler

Package : com.denachina.lcm.sdk
Interface : LCMSDK.EventHandler

Interface / Method
Parameters details

public void onInitComplete(

LCMInitializer lcmInitializer

) 

lcmInitializer

Sets LCMError here.
according to lcmInitializer.getLcmError() to judge LCMSDK.init success or fail.
if init success,invoke lcmInitializer.continueProcessing() and then do logic with game;
if init failed,inform users and then re-invoke LCMSDK.init();


public void onSessionUpdate (

 String accessToken,
User user

 )

accessToken
Sets access token. 
About the detail of access token, please see here.

 user
Sets user object.
About the detail of user object, please see here.

public void onSessionError (

 LCDError error

 )

error
Sets LCM error object.
About the detail of LCD error object, please see here.

public void onRemoteMessage (

 String message,
String extras

 )

message
Sets the message value of remote notification API.

 extras
Sets the extras value of remote notification API.

public void onUpdate (

LCMUpdater updater

)

updater
Help user to update App.

public void onAnnouncement (

LCMAnnouncement announcement

)

announcement
Help user to show announcement.

public void onActivation (

LCMActivation activation

)

activation
If the user need a code to auth , this will be called.

public void onLogoutComplete(

String extra

)

extra
Extra info.

LCMSDK.OnGetAllUserIdsComplete

Package : com.denachina.lcm.sdk
Interface : LCMSDK.OnGetAllUserIdsComplete

 

Interface
Parameters details
Note

public void onComplete(

List<IdBean> idBeanList,

LCMError error

)

idBeanList

long userId
int status

error

null if no error occurred, otherwise a valid LCMError

The callback of the getAllUserIds.

status:

0 for unactive

1 for active

2 for disable

 

LCMSDK.OnResetUserComplete

Package : com.denachina.lcm.sdk
Interface : LCMSDK.OnResetUserComplete

 

Interface
Parameters details
Note

public void onComplete(

User userBefore,

User userAfter,

String accessToken,

LCMError error

)

 userBefore 

The userId before reset.

 

userAfter

 

The UserId after reset.

accessToken

The current accessToken.

error

null if no error occurred, otherwise a valid LCMError
The callback of the resetUser.

 

LCMSDK.OnSwitchUserComplete

Package : com.denachina.lcm.sdk
Interface : LCMSDK.OnSwitchUserComplete

 

Interface
Parameters details
Note

public void onComplete(

User userBefore,

User userAfter,

String accessToken,

LCMError error

)

 userBefore 

The userId before switch.

 

userAfter

 

The UserId after switch.

accessToken

The current accessToken.

error

null if no error occurred, otherwise a valid LCMError
The callback of the switchUser.

 

LCMSDK.OnRealNameListener

Package : com.denachina.lcm.sdk
Interface : LCMSDK.OnRealNameListener

Interface
Parameters details
Note
public void onComplete(String result, LCMError error)

result

The result of registering real name.

error

null if no error occurred, otherwise a valid LCMError

When error is null, means that the user registers real name successfully, now the result is JSON-FORMAT String object.

Otherwise, there is an error occurred, CP can distinguish different errors by error.getErrorCode(), and now the result is null.

LCMError

Package : com.denachina.lcm.sdk
Class : LCMError

Interface / Method
Parameters details
Note

public int getErrorCode()

 errorCode is from LCM server

public String getErrorMessage()

 errorMessage is from LCM server

public LCMError.ErrorType getErrorType()

 

Enum:{LCM_ERROR,NETWORK_ERROR,USER_CANCEL,STORE_CREDENTIAL_ERROR, AUTH_CREDENTIAL_NO_GOOGLE_ACCOUNT}

AUTH_CREDENTIAL_NO_GOOGLE_ACCOUNT只会在Google商店中返回,当设备没有登录Google账户,且系统低于6.0的时候,会返回该error type.

LCMInitializer

Package : com.denachina.lcm.sdk
Class : LCMInitializer

Interface / Method
Parameters details
Note
public void continueProcessing() continue doing some logic with LCMSDK.
public LCMError getLcmError() LCMError when LCMSDK.init() went wrong.

LCMSDK.LCMAdditionalFunction

package:com.denachina.lcm.sdk

enum:LCMAdditionalFunction

enum / Method
code
Note
STORE_ACCOUNT_MANAGER0open user center
public int getCode() gets the enum's code
Back to top