系統(tǒng)接口
初始化
接口說(shuō)明:初始化SDK入口,輸入必要的app信息,初始化的回調(diào)為異步。
前置條件:無(wú)
函數(shù)原型:public static void init(Context context, String appKey, String appSecret, IInitListener initListener, IAuthListener authListener)
參數(shù)說(shuō)明:
context應(yīng)用程序上下文;
appkey 在淘寶top平臺(tái)上申請(qǐng)的應(yīng)用唯一ID
appsecret在淘寶top平臺(tái)上申請(qǐng)的應(yīng)用對(duì)應(yīng)的秘鑰
initListener 初始化回調(diào)接口,初始化完成之前,調(diào)用任何SDK接口都是無(wú)效的,
authListener 接收有關(guān)登錄授權(quán)的所有回調(diào)
回調(diào)接口原型:
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();
}
請(qǐng)求樣例:
@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());
注銷接口
接口說(shuō)明:釋放SDK, 在程序退出時(shí)必須調(diào)用釋放。
前置條件:無(wú)
函數(shù)原型:public static void destroy()
參數(shù)說(shuō)明:無(wú)
請(qǐng)求樣例:AliTvSdk.destroy();
獲取SDK版本號(hào)
接口說(shuō)明:獲取當(dāng)前SDK的版本號(hào)。返回值為以下格式 “ostv_x.x.x.x”, 用于調(diào)試所用。
前置條件:無(wú)
函數(shù)原型:public static String getSdkVersion()
參數(shù)說(shuō)明:無(wú)
請(qǐng)求樣例:AliTvSdk.getSdkVersion();
Log開(kāi)關(guān)
接口說(shuō)明:Log信息打印,僅用于調(diào)試所用。為了運(yùn)行效率,請(qǐng)?jiān)谡桨l(fā)布前關(guān)閉log打印
前置條件:無(wú)
函數(shù)原型:public static void logSwitch(boolean open)
參數(shù)說(shuō)明:open: true/false —> 打開(kāi)/關(guān)閉;
請(qǐng)求樣例: AliTvSdk.logSwitch(true);