本文整理匯總了Java中com.tencent.mm.sdk.modelbase.BaseResp類的典型用法代碼示例。如果您正苦於以下問題:Java BaseResp類的具體用法?Java BaseResp怎麽用?Java BaseResp使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BaseResp類屬於com.tencent.mm.sdk.modelbase包,在下文中一共展示了BaseResp類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleResult
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
@Override
public void handleResult(Intent data) {
mIWXAPI.handleIntent(data, new IWXAPIEventHandler() {
@Override
public void onReq(BaseReq baseReq) {
}
@Override
public void onResp(BaseResp baseResp) {
switch (baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
ShareUtil.mShareListener.shareSuccess();
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
ShareUtil.mShareListener.shareCancel();
break;
default:
ShareUtil.mShareListener.shareFailure(new Exception(baseResp.errStr));
}
}
});
}
示例2: onResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
@Override
public void onResp(BaseResp resp) {
Log.d("wechat",resp.toString());
String msg = "";
if(resp.errCode == 0)
{
msg = "支付成功";
//支付成功回調刷新
}
else if(resp.errCode == -1)
{
msg = "已取消支付";
}
else if(resp.errCode == -2)
{
msg = "支付失敗";
}
ToastUitl.showShort(msg);
//關閉窗口
finish();
}
示例3: shareComplete
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
public static void shareComplete(SendMessageToWX.Resp resp) {
if (null != mCallback) {
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
mCallback.onSuccess();
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
mCallback.onCancel();
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
default:
mCallback.onFailure(new Exception("BaseResp.ErrCode.ERR_AUTH_DENIED"));
break;
}
}
}
示例4: onResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
public void onResp(BaseResp resp) {
switch (resp.errCode){
case 0:
callBack.onSuccess();
break;
case -1:
callBack.onError(resp.errCode,resp.errStr);
break;
case -2:
callBack.onCancel();
break;
default:
callBack.onError(resp.errCode,resp.errStr);
break;
}
}
示例5: handleIntent
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
private void handleIntent(Intent intent) {
if (intent == null) {
return;
}
SendAuth.Resp resp = new SendAuth.Resp(intent.getExtras());
if (resp.errCode == BaseResp.ErrCode.ERR_OK) {
//用戶同意
String code = resp.code;
String state = resp.state;
// 如果不是登錄
if (!"wechat_login".equals(state)) {
finish();
} else {
//上麵的code就是接入指南裏要拿到的code
getAccessTokenAndOpenId(code);
}
} else {
finish();
}
}
示例6: sendResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
public final boolean sendResp(BaseResp baseResp) {
if (this.detached) {
throw new IllegalStateException("sendResp fail, WXMsgImpl has been detached");
} else if (!WXApiImplComm.validateAppSignatureForPackage(this.context, "com.tencent.mm",
this.checkSignature)) {
a.a(TAG, "sendResp failed for wechat app signature check failed");
return false;
} else if (baseResp.checkArgs()) {
Bundle bundle = new Bundle();
baseResp.toBundle(bundle);
com.tencent.mm.sdk.a.a.a aVar = new com.tencent.mm.sdk.a.a.a();
aVar.n = bundle;
aVar.m = "weixin://sendresp?appid=" + this.appId;
aVar.k = "com.tencent.mm";
aVar.l = WXApp.WXAPP_MSG_ENTRY_CLASSNAME;
return com.tencent.mm.sdk.a.a.a(this.context, aVar);
} else {
a.a(TAG, "sendResp checkArgs fail");
return false;
}
}
示例7: dealOAuth
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
private void dealOAuth(BaseResp resp) {
if (resp.errCode == 0) {
loadOauthData("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + this
.WX_APPID + "&secret=" + this.WX_SECRET + "&code=" + ((Resp) resp).code +
"&grant_type=authorization_code");
} else if (resp.errCode == -2) {
SHARE_MEDIA share_media;
UMAuthListener uMAuthListener = this.mAuthListener;
if (this.isToCircle) {
share_media = SHARE_MEDIA.WEIXIN_CIRCLE;
} else {
share_media = SHARE_MEDIA.WEIXIN;
}
uMAuthListener.onCancel(share_media);
} else {
this.mAuthListener.onError(new SocializeException("aouth error! error code :" + resp
.errCode), this.isToCircle ? SHARE_MEDIA.WEIXIN_CIRCLE : SHARE_MEDIA.WEIXIN);
}
}
示例8: onResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
public void onResp(BaseResp baseResp) {
PingppLog.a("onResp");
if (baseResp.getType() == 5) {
PingppLog.d("PaymentActivity wx result errCode : " + baseResp.errCode + " , errStr:"
+ baseResp.errStr);
this.a.a = 0;
PingppLog.a("onResp wxPayStatus=" + this.a.a);
PingppObject.getInstance().wxErrCode = baseResp.errCode;
if (this.b != null) {
this.b.finish();
this.b = null;
return;
}
this.a.a();
}
}
示例9: onResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
@Override
public void onResp(BaseResp baseResp) {
switch (baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
Logger.e(TAG, ResHelper.getString(R.string.weixin_pay_success));
RxBusManager.post(EventConstant.KEY_PAY_RESULT, BaseResp.ErrCode.ERR_OK);
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
Logger.e(TAG, ResHelper.getString(R.string.weixin_pay_cancel));
RxBusManager.post(EventConstant.KEY_PAY_RESULT, BaseResp.ErrCode.ERR_USER_CANCEL);
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
Logger.e(TAG, ResHelper.getString(R.string.weixin_pay_fail));
RxBusManager.post(EventConstant.KEY_PAY_RESULT, BaseResp.ErrCode.ERR_AUTH_DENIED);
break;
default:
break;
}
finish();
}
示例10: onResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
/**
* 第三方應用發送到微信的請求處理後的響應結果,會回調到該方法
*
* @param resp
*/
@Override
public void onResp(BaseResp resp) {
int result = 0;
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
result = R.string.errcode_success;
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
result = R.string.errcode_cancel;
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
result = R.string.errcode_deny;
break;
default:
result = R.string.errcode_unknown;
break;
}
Toast.makeText(this, result, Toast.LENGTH_LONG).show();
}
示例11: onResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
@Override
public void onResp(BaseResp baseResp) {
//System.out.println("resp.errCode:" + baseResp.errCode + ",resp.errStr:" + baseResp.errStr);
switch (baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
//分享成功
System.out.println("分享成功");
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
//分享取消
System.out.println("分享取消");
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
//分享拒絕
System.out.println("分享拒絕");
break;
}
finish();
}
示例12: onResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
@Override
public void onResp(BaseResp baseResp) {
Log.e(WXEntryActivity.class.getSimpleName(), "resp.errCode:" + baseResp.errCode + ",resp.errStr:"
+ baseResp.errStr);
switch (baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
//分享成功
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
//分享取消
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
//分享拒絕
break;
}
}
示例13: onResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
@Override
public void onResp(BaseResp resp) {
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
ToastUtils.show(R.string.share_success);
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
break;
default:
ToastUtils.show(R.string.share_failure);
break;
}
finish();
}
示例14: onReceive
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
if (intent.hasExtra(ShareConstant.EXTRA_WEIXIN_RESULT)) {
int errCode = intent.getIntExtra(ShareConstant.EXTRA_WEIXIN_RESULT, BaseResp.ErrCode.ERR_USER_CANCEL);
int resultCode = (errCode == BaseResp.ErrCode.ERR_OK) ? Activity.RESULT_OK : Activity.RESULT_CANCELED;
if (resultCode == Activity.RESULT_OK) {
//分享成功
if (null != listener) {
listener.onShare(channel, ShareConstant.SHARE_STATUS_COMPLETE);
}
ToastUtil.showToast(context, R.string.share_success, true);
} else {
//分享失敗
if (null != listener) {
listener.onShare(channel, ShareConstant.SHARE_STATUS_FAILED);
}
// ToastUtil.showToast(context, R.string.share_failed, true);
}
}
}
示例15: onResp
import com.tencent.mm.sdk.modelbase.BaseResp; //導入依賴的package包/類
@Override
public void onResp(BaseResp baseResp) {
if(baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
if(WXPay.getInstance() != null) {
if(baseResp.errStr != null) {
Log.e("wxpay", "errstr=" + baseResp.errStr);
}
WXPay.getInstance().onResp(baseResp.errCode);
finish();
}
}
}