System interface


Initialization

##Interface Description:Initialize SDK entry, Enter the necessary app information, and the initialization callback is asynchronous.

Preconditions: None

Function prototype: public static void init(Context context, String appKey, String appSecret, IInitListener initListener, IAuthListener authListener)

Parameter description

contextapplication context;

appkey Apply on Taobao top platform The unique ID of the application

appsecretThe secret key corresponding to the application applied for on Taobao top platform

initListener initialization callback interface, before the initialization is completed, calling any SDK interface is invalid,

authListener receives all callbacks related to login authorization

Callback interface prototype:

public interface IInitListener {

public void onInitFinish();

public void onInitError(String errorMsg);

}

public interface IAuthListener {

public void onAuthSucess(int from);

public void onAuthError(int errCode, String errMsg);

public void onAuthCancel();

public void onLogout();

}

Request sample:

AliTvSdk.
init(mContext, appkey, appSecret, new IInitListener() {

@Override

public void onInitFinish() {

TestToast.

show("init aliTvSdk ok. get auth = " AliTvSdk.Account.isAuth());

}

@Override

public void onInitError(String errorMsg) {

TestToast.show(errorMsg);

}

}, new TestAccount());


Logout interface

##Interface description: ReleaseSDK, must be executed when the program exits Call release.

Preconditions: None

Function prototype: public static void destroy()

Parameter description: None

Request example: AliTvSdk.destroy();

Get the SDK version number

Interface description: Get the version number of the current SDK. The return value is in the following format “ostv_x.x.x.x”, which is used for debugging.

Preconditions: None

Function prototype: public static String getSdkVersion()

Parameter description: None

Request example: AliTvSdk.getSdkVersion();

Log switch

Interface description: Log information printing is only used for debugging. For operational efficiency, please turn off log printing before official release

Preconditions: None

Function prototype: public static void logSwitch(boolean open)

Parameter description: open: true/false —> open/close;

Request example: AliTvSdk.logSwitch(true );