/** * 执行请求 * * @param url * @param params * @param httpMethod * @param listener */ private void request( final String url, final WeiboParameters params, final String httpMethod, RequestListener listener) { params.add("access_token", accessToken); AsyncWeiboRunner.request(url, params, httpMethod, listener); }
/** 根据code获取AccessToken */ public void getAccessTokenByCode(String code, RequestListener listener) { WeiboParameters params = new WeiboParameters(); params.add(Constants.SINA_CLIENT_ID, Constants.SINA_APP_KEY); params.add(Constants.SINA_CLIENT_SECRET, Constants.SINA_APP_SECRET); params.add(Constants.SINA_GRANT_TYPE, Constants.SINA_GRANT_TYPE_VALUE); params.add(Constants.SINA_CODE, code); params.add(Constants.SINA_REDIRECT_URI, Constants.SINA_REDIRECT_URL); AsyncWeiboRunner.request(URL_ACCESS_TOKEN, params, HTTPMETHOD_POST, listener); }