com.tencent.mm.sdk.openapi.IWXAPIEventHandler Java Examples

The following examples show how to use com.tencent.mm.sdk.openapi.IWXAPIEventHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WxShareInstance.java    From ShareUtil with Apache License 2.0 6 votes vote down vote up
@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));
            }
        }
    });
}
 
Example #2
Source File: WxLoginInstance.java    From ShareUtil with Apache License 2.0 5 votes vote down vote up
@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));
                }
            }
        }
    });
}
 
Example #3
Source File: RLWeixinHelper.java    From Roid-Library with Apache License 2.0 4 votes vote down vote up
boolean handleIntent(Intent intent, IWXAPIEventHandler handler) {
    return api.handleIntent(intent, handler);
}
 
Example #4
Source File: WChatManager.java    From Android-Application-ZJB with Apache License 2.0 2 votes vote down vote up
/**
 * 处理微信的回调
 *
 * @param intent  activity的意图界面
 * @param handler 微信回调
 */
public void handleIntent(Intent intent, IWXAPIEventHandler handler) {
    WXAPI.handleIntent(intent, handler);
}