帮助与文档

> >
다운로드

代码调用

ShareSDK根据用户授权设备,可以返回一些用户标签,开发者可以根据返回标签给用户标记,甚至精准推送等;

代码说明如下,我们拿QQ授权举例;

   private void login(){
        ShareSDK.setEnableAuthTag(true);//SDK登录+标签必须设置成true
        cn.sharesdk.framework.Platform sina = ShareSDK.getPlatform(QQ.NAME);
        sina.setPlatformActionListener(new PlatformActionListener() {

            @Override
            public void onError(Platform arg0, int arg1, Throwable arg2) {
                // TODO Auto-generated method stub
                System.out.println("------------失败"+arg2.toString());
                arg2.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        Toast.makeText(MobSDK.getContext(),"失败", Toast.LENGTH_SHORT).show();
                        System.out.println("----------");
                    }
                });
            }

            @Override
            public void onComplete(Platform arg0, int arg1, HashMap<String, Object> arg2) {
                // TODO Auto-generated method stub
                login = arg0.getDb().get("userTags");//获取返回SDK+标签
                System.out.println("---------userTags---"+login);
               runOnUiThread(new Runnable() {
                    public void run() {
                        Toast.makeText(MobSDK.getContext(),"成功"+login, Toast.LENGTH_SHORT).show();
                    }
                });
            }

            @Override
            public void onCancel(Platform arg0, int arg1) {
                // TODO Auto-generated method stub
                System.out.println("-------取消");
            }
        });
        sina.SSOSetting(false);//设置客户端授权
        ShareSDK.setActivity(this);//抖音登录适配安卓9.0
        sina.showUser(null);
    }

注意,获取标签后会将标签存储到数据库中,想要重新获取,需要移除授权重新获取;

다운로드 웹 폰트 다운로드 다운로드 에버노트 다운로드