private void initAccessToken(String token, String expires_in) { Token accessToken = new Token(token, Weibo.getAppSecret()); accessToken.setExpiresIn(expires_in); Weibo.getInstance().setAccessToken(accessToken); share2weibo(Constants.shareContent); if (isSinaTiaoZhuan) { Intent intent = new Intent(); intent.setClass(MoreActivity.this, ShareActivity.class); startActivity(intent); } }
// sina 微博 private void oauth() { Weibo weibo = Weibo.getInstance(); weibo.setupConsumerConfig(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET); // Oauth2.0 // 隐式授权认证方式 weibo.setRedirectUrl(Constants.CONSUMER_URL); // 此处回调页内容应该替换为与appkey对应的应用回调页 // 对应的应用回调页可在开发者登陆新浪微博开发平台之后, // 进入我的应用--应用详情--应用信息--高级信息--授权设置--应用回调页进行设置和查看, // 应用回调页不可为空 weibo.authorize(UserLogin.this, new AuthDialogListener()); }
private void share2weibo(String content) { Weibo weibo = Weibo.getInstance(); weibo.share2weibo( this, weibo.getAccessToken().getToken(), weibo.getAccessToken().getSecret(), content, ""); }