本文整理汇总了Java中com.tencent.mm.opensdk.openapi.IWXAPIEventHandler类的典型用法代码示例。如果您正苦于以下问题:Java IWXAPIEventHandler类的具体用法?Java IWXAPIEventHandler怎么用?Java IWXAPIEventHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IWXAPIEventHandler类属于com.tencent.mm.opensdk.openapi包,在下文中一共展示了IWXAPIEventHandler类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleResult
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; //导入依赖的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: WXHandler
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; //导入依赖的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) {
}
};
}
示例3: onWXEntryActivityOnCreate
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; //导入依赖的package包/类
/**
* 在WXEntryActivity onCreate方法中执行
*/
public static void onWXEntryActivityOnCreate(Activity wXPayEntryActivity, IWXAPIEventHandler iwxapiEventHandler){
api = WXAPIFactory.createWXAPI(wXPayEntryActivity, null);
api.registerApp(AppConstant.APP_ID);
api.handleIntent(wXPayEntryActivity.getIntent(), iwxapiEventHandler);
}
示例4: run
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; //导入依赖的package包/类
@Override
public void run() {
if (mAction.getPayType() == Pay.PayType.APIPAY) {
PayTask payTask = new PayTask(mPay.getContext());
String mapToParameters = Utils.getMapToParameters(mPayInfo.getOrderInfo(Map.class));
Map<String, String> result = payTask.payV2(mapToParameters, false);
PayResult payResult = new PayResult(result);
if (TextUtils.equals(payResult.getResultStatus(), "9000")) {
mDispatcher.dispatchResult(Dispatcher.SUCCESS, this);
} else {
mDispatcher.dispatchResult(Dispatcher.FAILED, this);
}
} else if (mAction.getPayType() == Pay.PayType.WECHAT) {
PayReq payReq = mPayInfo.getOrderInfo(PayReq.class);
IWXAPI msgApi = WXAPIFactory.createWXAPI(mPay.getContext(), null);
msgApi.registerApp(payReq.appId);
msgApi.handleIntent(mPay.getContext().getIntent(), new IWXAPIEventHandler() {
@Override
public void onReq(BaseReq baseReq) {
}
@Override
public void onResp(BaseResp baseResp) {
}
});
}
}
示例5: handleResult
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; //导入依赖的package包/类
@Override
public void handleResult(int requestCode, int resultCode, Intent data) {
mIWXAPI.handleIntent(data, new IWXAPIEventHandler() {
@Override
public void onReq(BaseReq baseReq) {
}
@Override
public void onResp(BaseResp baseResp) {
if (baseResp instanceof SendAuth.Resp && baseResp.getType() == 1) {
SendAuth.Resp resp = (SendAuth.Resp) baseResp;
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
getToken(resp.code);
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
mLoginListener.loginCancel();
break;
case BaseResp.ErrCode.ERR_SENT_FAILED:
mLoginListener.loginFailure(new Exception(INFO.WX_ERR_SENT_FAILED));
break;
case BaseResp.ErrCode.ERR_UNSUPPORT:
mLoginListener.loginFailure(new Exception(INFO.WX_ERR_UNSUPPORT));
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
mLoginListener.loginFailure(new Exception(INFO.WX_ERR_AUTH_DENIED));
break;
default:
mLoginListener.loginFailure(new Exception(INFO.WX_ERR_AUTH_ERROR));
}
}
}
});
}
示例6: handleIntent
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; //导入依赖的package包/类
boolean handleIntent(Intent intent, IWXAPIEventHandler eventHandler) {
return mWXApi.handleIntent(intent, eventHandler);
}
示例7: onNewIntent
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; //导入依赖的package包/类
@Override
public void onNewIntent(Activity activity) {
if (activity instanceof IWXAPIEventHandler && mWxApi != null)
mWxApi.handleIntent(activity.getIntent(), (IWXAPIEventHandler) activity);
}
示例8: onWXEntryActivityOnNewIntent
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; //导入依赖的package包/类
/**
* 在WXEntryActivity onNewIntent方法中执行
*/
public static void onWXEntryActivityOnNewIntent(Activity wXPayEntryActivity, Intent intent, IWXAPIEventHandler iwxapiEventHandler){
wXPayEntryActivity.setIntent(intent);
api.handleIntent(intent, iwxapiEventHandler);
}
示例9: getWXEventHandler
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; //导入依赖的package包/类
public IWXAPIEventHandler getWXEventHandler() {
return this.mEventHandler;
}