智慧服务,成就美好体验 项目咨询

主页 > 服务与支持 > 开发平台 > 客户端SDK参考 > Android UI SDK > 接口参考 登录鉴权

入门使用

登录鉴权

更新时间:2019-11-20

clmLogin

接口描述

该接口用于登录和鉴权。

注意事项

在使用其他业务之前必须进行成功登录。

说明: 

登录成功以后会发送登录成功事件onCompleted回调。

方法定义

1
2
3
4
5
6
7
 /**
     * 登录接口
     * @param account 账号
     * @param password 密码
     * @param handler 回调对象
     */
    void clmLogin(@NonNull String account, @NonNull String password, CLMCompleteHandler handler);
 

参数描述

表1 参数说明

参数

是否必须

类型

描述

account

String

帐号。

password

String

密码。

handler

CLMCompleteHandler

回调处理对象

返回值

无。

代码示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
//调用
public void login(View view){
   String account = "hwyf";  
   String pasword = "123@456";  
   CloudLinkSDK.getOpenApi().clmLogin(account, password,
              new CLMCompleteHandler() {
                    @Override
                  public void onCompleted(CLMResult result) {
                      DemoActivity.this.dismissLoadingDialog();
                      if (result.getCode() == 0){
                          Toast.makeText(DemoActivity.this,"登录成功",Toast.LENGTH_LONG).show();
                      }else {
                          Log.e(TAG,"login fail" + result.getMessage());
                          Toast.makeText(DemoActivity.this,"登录失败"+ result.getMessage(),Toast.LENGTH_LONG).show();
                      }
                  }
              });