获取openid及unionid

MyLoginNotify myApiNotify= new MyLoginNotify(); 
        LjDySdk.getDyOpenId(myBehaviour, myApiNotify, true);

描述:获取openid及unionid。

参数:

名称 类型 描述 必填
behaviour Behaviour对象 用于请求的封装参数
myApiNotify LoginApiNotify 登录成功后的回调通知
force bool 是否强制重新登录

使用示例:



    //抖音登录按钮的事件处理
    public void dyLoginClick()
    {
        DySdkLog.Log("click dyLoginClick");
        MyLoginNotify myApiNotify= new MyLoginNotify(); 
        LjDySdk.getDyOpenId(myBehaviour, myApiNotify, true);
        
    }

    //如果本身不用知道结果获取openid,则直接传 new LoginApiNotify()
    class MyLoginNotify : LoginApiNotify
    {
        public override void notifySuccess(string str)
        {
            base.notifySuccess(str);
            // {"openid":"oJB4r5Nqm4w3sgqvdG1aIETvq8cE","unionid":""}
            DySdkLog.Log("MyLoginNotify notifySuccess=" + str);
            //如果程序中要立马使用可以在这里获取
            string openid = LjDySdk.getDySaveOpenid();
            string unionid = LjDySdk.getDySaveUnionid();
            DySdkLog.Log("MyLoginNotify openid=" + openid);
            DySdkLog.Log("MyLoginNotify unionid=" + unionid);
        }
        
    }