Android登录(必接)
登录方法
PTSdk.getInstance().doLogin();
回调
初始化时设置的回调函数public void OnLoginNotify(PTAccountInfo ptAccountInfo) ;中
回调中的数据结构
帐号信息
public class PTAccountInfo{
/**
* code : 1
* data : {"players_id":117,"account":"pthu_nU72","tick":1525852988,"token":"eff970d4a11bc6501f4b1aa4a1770cae","is_phone":0}
*/
private int code; //对应PTCode.CODE_SUCCESS 登陆成功
private Data data; //玩家帐号数据
private String msg; //异常信息
}
public static class Data {
/**
* players_id : 117
* account : pthu_nU72
* password : pthu_rte3
* tick : 1525852988
* token : eff970d4a11bc6501f4b1aa4a1770cae
* is_phone : 0
*/
private int players_id; //玩家id
private String account; //玩家帐号
private int tick; //登录时间戳
private String token; //登录token
private String password; //空值
private int is_phone; //玩家绑定的手机号码
}
错误码
public class PTCode {
public final static int CODE_SUCCESS = 1; //成功
public final static int CODE_NO_NETWORK = 1001; //网络异常
public final static int CODE_UNLOGIN = 1002; //未登录
public final static int CODE_UNERROR = 1003; //未知异常
public final static int CODE_PAY_SUCCESS = 9000; //支付成功
public final static int CODE_PAY_CANCEL= 6001; //用户取消支付
public final static int CODE_PAY_NETWORK_ERROR= 6002; //支付网络异常
}