예제 #1
0
  @Override
  public void loadData() {

    this.reqMethod = Method.POST;
    this.reqUrl = TenShareImpl.URL_SERVER + "/t/add";

    TenTokenBean mTencentWeiboTokenBean = new TenTokenBean();
    SharedPreferenceUtil.Fetch(
        ContextMgr.getContext(),
        OpenManager.getInstatnce().getSpName(OpenManager.TENCENT_WEIBO),
        mTencentWeiboTokenBean);

    this.formMultParamList.add(new BasicNameValuePair("oauth_consumer_key", TenShareImpl.APP_KEY));
    this.formMultParamList.add(
        new BasicNameValuePair("access_token", mTencentWeiboTokenBean.access_token));
    this.formMultParamList.add(new BasicNameValuePair("openid", mTencentWeiboTokenBean.openid));
    this.formMultParamList.add(new BasicNameValuePair("clientip", IpUtils.getPsdnIp()));
    this.formMultParamList.add(new BasicNameValuePair("oauth_version", "2.a"));
    this.formMultParamList.add(new BasicNameValuePair("scope", "all"));

    this.formMultParamList.add(new BasicNameValuePair("format", "json"));
    this.formMultParamList.add(
        new BasicNameValuePair("content", mBundle.getString(OpenManager.BUNDLE_KEY_TEXT)));
    this.formMultParamList.add(new BasicNameValuePair("clientip", IpUtils.getPsdnIp()));
    this.formMultParamList.add(
        new BasicNameValuePair("jing", mBundle.getString(OpenManager.BUNDLE_KEY_LONGITUDE)));
    this.formMultParamList.add(
        new BasicNameValuePair("wei", mBundle.getString(OpenManager.BUNDLE_KEY_LATITUDE)));
    this.formMultParamList.add(new BasicNameValuePair("syncflag", "0"));

    byte[] postBody = TFormBodyUtil.getPostData(reqHeards, formMultParamList);
    this.reqPostDate = postBody;
  }
예제 #2
0
  @Override
  public void handleData() {
    String str = com.open.share.utils.HttpEntityReadUtil.getString(this.readObj);
    LogUtil.v("StatusUpdateMsg handleData():", "---" + str);
    if (!TextUtils.isEmpty(str)) {
      OpenResponse ret = new OpenResponse();
      try {
        JSONObject object = new JSONObject(str);
        if (null != object) {
          ret.ret = object.optInt("ret", OpenResponse.RET_FAILED);
          if (ret.ret == OpenResponse.RET_OK) {

          } else {
            ret.errcode = object.optInt("error_code", -1);
            ret.errmsg = object.optString("error", "");
          }

          if (ret.ret == 3) {
            SharedPreferenceUtil.clear(
                ContextMgr.getContext(),
                OpenManager.getInstatnce().getSpName(OpenManager.TENCENT_WEIBO));

            Intent intent = new Intent();
            intent.setAction(OpenManager.AUTH_RESULT_ACTION);
            intent.putExtra(OpenManager.BUNDLE_KEY_OPEN, OpenManager.TENCENT_WEIBO);
            ContextMgr.getContext().sendBroadcast(intent);
          }

          this.resObj = ret;
          return;
        }
      } catch (JSONException e) {
        e.printStackTrace();
      }
    }
  }