本文整理汇总了Java中com.tencent.mm.opensdk.constants.ConstantsAPI类的典型用法代码示例。如果您正苦于以下问题:Java ConstantsAPI类的具体用法?Java ConstantsAPI怎么用?Java ConstantsAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConstantsAPI类属于com.tencent.mm.opensdk.constants包,在下文中一共展示了ConstantsAPI类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onResp
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onResp(BaseResp resp) {
Log.e(TAG, "transaction = " + resp.transaction + ", type = " + resp.getType() + ", errCode = " + resp.errCode + ", err = " + resp.errStr);
if (resp.errCode == BaseResp.ErrCode.ERR_OK) {
switch (resp.getType()) {
case ConstantsAPI.COMMAND_SENDAUTH:
onResultOk((SendAuth.Resp) resp);
break;
case ConstantsAPI.COMMAND_PAY_BY_WX:
onResultOk((PayResp) resp);
break;
case ConstantsAPI.COMMAND_SENDMESSAGE_TO_WX:
onResultOk((SendMessageToWX.Resp) resp);
break;
}
} else if (resp.errCode == BaseResp.ErrCode.ERR_USER_CANCEL) {
mCallback.onFailed(mActivity, ResultCode.RESULT_CANCELLED, toMessage(resp));
} else {
mCallback.onFailed(mActivity, ResultCode.RESULT_FAILED, toMessage(resp));
}
mCallback.onCompleted(mActivity);
}
开发者ID:czy1121,项目名称:sdk3rd,代码行数:24,代码来源:WXBase.java
示例2: onResp
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onResp(BaseResp resp) {
Log.d(TAG, "onPayFinish, errCode = " + resp.errCode);
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
// AlertDialog.Builder builder = new AlertDialog.Builder(this);
// builder.setTitle(R.string.app_tip);
// builder.setMessage(getString(R.string.pay_result_callback_msg, String.valueOf(resp.errCode)));
// builder.show();
if (resp.errCode == 0){
Log.e("WXPayEvent",resp.errCode+":"+WXPayEvent.PAY_Ok);
EventBus.getDefault().post(new WXPayEvent(WXPayEvent.PAY_Ok));
}else{
Log.e("WXPayEvent",resp.errCode+":"+WXPayEvent.PAY_ERR);
EventBus.getDefault().post(new WXPayEvent(WXPayEvent.PAY_ERR));
}
finish();
}
}
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:20,代码来源:WXPayEntryActivity.java
示例3: onResp
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onResp(BaseResp resp) {
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
// resp.errCode == -1
// 原因:支付错误,可能的原因:签名错误、未注册APPID、项目设置APPID不正确、注册的APPID与设置的不匹配、其他异常等
// resp.errCode == -2 原因 用户取消,无需处理。发生场景:用户不支付了,点击取消,返回APP
if (resp.errCode == 0) {
ToastUtil.showToast(this, "微信支付成功");
if (JrmfClient.WX_PAY_TYPE == JrmfClient.WX_PAY_TYPE_RED_PACKET) {
// 发红包支付成功-需要关闭支付页面
JrmfRpClient.closePayAndSendRpPageWithResult();
} else if (JrmfClient.WX_PAY_TYPE == JrmfClient.WX_PAY_TYPE_WALLET_PAY) {
//关闭收银台支付页面并提示用户
// JrmfWalletPayClient.closePayPageWithResult();
}
} else {
ToastUtil.showToast(this, "取消" + resp.errCode + "test");
}
finish();
}
}
开发者ID:newDeepLearing,项目名称:decoy,代码行数:22,代码来源:WXPayEntryActivity.java
示例4: onResp
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onResp(BaseResp resp) {
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
if(resp.errCode == 0)
{
Toast.makeText(this, "支付成功", Toast.LENGTH_LONG).show();
}
else if(resp.errCode == -1)
{
Toast.makeText(this, "支付出错:" + resp.errStr, Toast.LENGTH_LONG).show();
}
else if(resp.errCode == -2)
{
Toast.makeText(this, "取消支付", Toast.LENGTH_LONG).show();
}
}
finish();
}
开发者ID:wanliyang1990,项目名称:AppServiceRestFul,代码行数:19,代码来源:WXPayEntryActivity.java
示例5: WXHandler
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
public WXHandler() {
this.mEventHandler = new IWXAPIEventHandler() {
public void onResp(BaseResp resp) {
if(!mLastTransaction.equals(resp.transaction)) {
return;
}
int type = resp.getType();
switch(type) {
case ConstantsAPI.COMMAND_SENDAUTH: //授权返回
WXHandler.this.onAuthCallback((SendAuth.Resp)resp);
break;
case ConstantsAPI.COMMAND_SENDMESSAGE_TO_WX: //分享返回
WXHandler.this.onShareCallback((SendMessageToWX.Resp)resp);
break;
}
}
public void onReq(BaseReq req) {
}
};
}
开发者ID:tsy12321,项目名称:SocialSDKAndroid,代码行数:25,代码来源:WXHandler.java
示例6: onResp
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onResp(BaseResp baseResp) {
if (baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
Wxpay.getInstance(this).onResp(baseResp);
finish();
}
}
开发者ID:Jamling,项目名称:af-pay,代码行数:8,代码来源:WXPayActivity.java
示例7: onReq
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onReq(BaseReq req) {
switch (req.getType()) {
case ConstantsAPI.COMMAND_GETMESSAGE_FROM_WX:
// goToGetMsg();
break;
case ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX:
// goToShowMsg((ShowMessageFromWX.Req) req);
break;
default:
break;
}
Toast.makeText(this, req.openId, Toast.LENGTH_LONG).show();
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:16,代码来源:WXEntryActivity.java
示例8: onResp
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onResp(BaseResp baseResp) {
if(baseResp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
if(WxPay.getCurrentIns() != null) {
if(baseResp.errStr != null) {
Log.e("wxpay", "errstr=" + baseResp.errStr);
}
WxPay.getCurrentIns().onResp(baseResp.errCode);
}
finish();
}
}
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:14,代码来源:WXPayCallbackActivity.java
示例9: onResponse
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onResponse(Object resp) {
if (!(resp instanceof BaseResp)) {
return;
}
BaseResp baseResp = (BaseResp) resp;
if (baseResp.getType() == ConstantsAPI.COMMAND_SENDAUTH) {
// 登录
switch (baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
// 用户同意 authResp.country; authResp.lang; authResp.state;
SendAuth.Resp authResp = (SendAuth.Resp) resp;
String auth_code = authResp.code;
mWeChatLoginHelper.getAccessTokenByCode(auth_code);
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
// 用户取消
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
// 用户拒绝授权
break;
}
} else if (baseResp.getType() == ConstantsAPI.COMMAND_SENDMESSAGE_TO_WX) {
if (mOnShareListener == null) {
return;
}
// 分享
switch (baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
// 分享成功
mOnShareListener.onSuccess();
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
// 分享取消
mOnShareListener.onCancel();
break;
case BaseResp.ErrCode.ERR_SENT_FAILED:
// 分享失败
mOnShareListener.onFailure(new SocialException("分享失败"));
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
// 分享被拒绝
mOnShareListener.onFailure(new SocialException("分享被拒绝"));
break;
}
}
}
开发者ID:chendongMarch,项目名称:SocialSdkLibrary,代码行数:48,代码来源:WxPlatform.java
示例10: onResp
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onResp(BaseResp resp) {
Log.d(WechatModule.TAG, "[BaseResp]");
Log.d(WechatModule.TAG, resp.toString());
String message = null;
JSONObject result = new JSONObject();
if (resp.errCode == 0) {
switch (resp.getType()) {
case ConstantsAPI.COMMAND_SENDAUTH:
SendAuth.Resp res = ((SendAuth.Resp) resp);
result.put("code", res.code);
result.put("state", res.state);
result.put("country", res.country);
result.put("lang", res.lang);
break;
default:
break;
}
} else {
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_USER_CANCEL:
message = WechatModule.ERROR_WECHAT_RESPONSE_USER_CANCEL;
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
message = WechatModule.ERROR_WECHAT_RESPONSE_AUTH_DENIED;
break;
case BaseResp.ErrCode.ERR_SENT_FAILED:
message = WechatModule.ERROR_WECHAT_RESPONSE_SENT_FAILED;
break;
case BaseResp.ErrCode.ERR_UNSUPPORT:
message = WechatModule.ERROR_WECHAT_RESPONSE_UNSUPPORT;
break;
case BaseResp.ErrCode.ERR_COMM:
message = WechatModule.ERROR_WECHAT_RESPONSE_COMMON;
break;
default:
message = WechatModule.ERROR_WECHAT_RESPONSE_UNKNOWN;
break;
}
message = resp.errStr != null ? resp.errStr : message;
}
WechatModule.getInstance(this).onResp(resp.errCode, result, message);
finish();
}
开发者ID:natjs,项目名称:nat-wechat,代码行数:52,代码来源:EntryActivity.java
示例11: onResp
import com.tencent.mm.opensdk.constants.ConstantsAPI; //导入依赖的package包/类
@Override
public void onResp(BaseResp resp) {
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("提示");
String result = resp.errCode == 0 ? "成功" : resp.errCode == -1 ? "失败" : "取消";
builder.setMessage("微信支付结果:" + result);
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
finish();
}
});
builder.show();
if (resp.errCode == 0) {
if (PayActivity.instance != null) {
//1财神币 2微信 3支付宝 4银联 5积分
PayActivity.instance.finishPay(2);
}
if (TributePayActivity.instance != null) {
try {
TributePayActivity.instance.doNext();
} catch (Exception e) {
}
}
if (MyOrderDelegate.instance != null) {
MyOrderDelegate.instance.refreshData(1);
MyOrderDelegate.instance.refreshData(2);
}
if (MoneyHistoryActivity.instance != null) {
MoneyHistoryActivity.instance.reFreshHistory();
CenterFragment.instance.getMyInfo();
}
if (PayShopActivity.instance != null) {
PayShopActivity.instance.finish();
}
}
finish();
}
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:43,代码来源:WXPayEntryActivity.java
注:本文中的com.tencent.mm.opensdk.constants.ConstantsAPI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论