本文整理汇总了Java中com.tencent.mm.sdk.modelmsg.SendAuth.Resp方法的典型用法代码示例。如果您正苦于以下问题:Java SendAuth.Resp方法的具体用法?Java SendAuth.Resp怎么用?Java SendAuth.Resp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.mm.sdk.modelmsg.SendAuth
的用法示例。
在下文中一共展示了SendAuth.Resp方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleIntent
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的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();
}
}
示例2: onResp
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void onResp(BaseResp resp) {
Log.e(TAG, "onResp...");
Log.i("Apptest", "onResp...");
String code = null;
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:// 用户同意,只有这种情况的时候code是有效的
code = ((SendAuth.Resp) resp).code;
Log.i("Apptest", code);
getResult(code);
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:// 用户拒绝授权
Log.e("Apptest", "用户拒绝授权");
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:// 用户取消
Log.e("Apptest", "用户取消");
break;
default:// 发送返回
break;
}
finish();
}
示例3: authComplete
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
public static void authComplete(SendAuth.Resp resp) {
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
callback.onGetCodeSuccess(resp.code);
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
callback.onCancel();
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
callback.onFailure(new Exception("BaseResp.ErrCode.ERR_AUTH_DENIED"));
break;
}
}
示例4: onResp
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void onResp(BaseResp resp) {
if (resp instanceof SendAuth.Resp)
WeChatSSOProxy.authComplete((SendAuth.Resp) resp);
else if (resp instanceof SendMessageToWX.Resp)
WeChatShareProxy.shareComplete((SendMessageToWX.Resp) resp);
finish();
}
示例5: onEventMainThread
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(BaseRespEvent event) {
if (ShareType == ShareConstant.SHARE) {
this.onDestroy();
}
BaseResp baseResp = event.getBaseResp();
if (baseResp.errCode == BaseResp.ErrCode.ERR_USER_CANCEL) {
shareListener.onCancel(ShareType, platform);
return;
}
if (ShareType == ShareConstant.AUTH) {
SendAuth.Resp resp = (SendAuth.Resp) baseResp;
if (TextUtils.isEmpty(resp.code)) {
return;
}
this.code = resp.code;
}
switch (baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
shareListener.onComplete(ShareType, platform, event);
if (ShareType == ShareConstant.SHARE) {
MyNetUtils.shareCount(App.getDefault(), contentId);
}
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
shareListener.onCancel(ShareType, platform);
break;
default:
ShareException exception = new ShareException("被拒绝或者失败啦");
shareListener.onException(ShareType, platform, exception);
break;
}
}
示例6: onResp
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void onResp(BaseResp resp) {
Log.e(TAG, "onResp...");
Log.i("Apptest", "onResp...");
SDKLog.d(TAG + " onResp...");
String code = null;
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:// 用户同意,只有这种情况的时候code是有效的
code = ((SendAuth.Resp) resp).code;
Log.i("Apptest", code);
SDKLog.d(TAG + " code..." + code);
getResult(code);
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:// 用户拒绝授权
Log.e("Apptest", "用户拒绝授权");
SDKLog.d(TAG + " 用户拒绝授权...");
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:// 用户取消
Log.e("Apptest", "用户取消");
SDKLog.d(TAG + " 用户取消...");
break;
default:// 发送返回
break;
}
finish();
}
示例7: onResp
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void onResp(BaseResp resp) {
String result = "";
Bundle bundle = new Bundle();
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
resp.toBundle(bundle);
SendAuth.Resp sp = new SendAuth.Resp(bundle);
//发送成功
if (sp.code != null) {
// Constants.getcode = sp.code;
getWxResult(sp.code);
return;
} else {
result = "分享成功";
}
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
result = "分享取消";
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
result = "分享拒绝";
break;
default:
result = "分享返回";
break;
}
Log.e("分享返回==>","返回成功");
/*if (!StringUtils.isEmpty(result))
Toast.makeText(this, result, Toast.LENGTH_LONG).show();*/
finish();
}
示例8: onResp
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void onResp(BaseResp resp) {
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
if (resp instanceof SendAuth.Resp) {
// 第三方登录
}
if (resp.transaction.contains(ShareWechatImpl.TRANSACTION)) {
// 分享回调
}
break;
}
finish();
}
示例9: onResp
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override public void onResp(BaseResp baseResp) {
Log.d("onResp", "onResp " + baseResp);
if(baseResp instanceof SendAuth.Resp) {
WeChatManager.handleSso((SendAuth.Resp)baseResp);
}else if(baseResp instanceof SendMessageToWX.Resp) {
}
finish();
}
示例10: handleSso
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
public static void handleSso(SendAuth.Resp baseResp) {
if (callback != null) {
if (baseResp.errCode == BaseResp.ErrCode.ERR_USER_CANCEL) {
callback.onCancel();
} else if (baseResp.errCode == BaseResp.ErrCode.ERR_AUTH_DENIED) {
callback.onFailure(new Exception("BaseResp.ErrCode.ERR_AUTH_DENIED"));
} else if (baseResp.errCode == BaseResp.ErrCode.ERR_UNSUPPORT) {
callback.onFailure(new Exception("BaseResp.ErrCode.ERR_UNSUPPORT"));
} else if (baseResp.errCode == BaseResp.ErrCode.ERR_OK) {
callback.onGetCodeSuccess(baseResp.code);
}
}
}
示例11: onResp
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
/**
* 微信授权后回调
*
* @param baseResp
*/
@Override
public void onResp(BaseResp baseResp) {
int result = 0;
//type=1 登录回调 type=2 分享回调
int type = baseResp.getType();
switch (baseResp.errCode) {
//用户授权成功
case BaseResp.ErrCode.ERR_OK:
if (type == WXLOGIN) {
result = R.string.errcode_success;
if (baseResp instanceof SendAuth.Resp) {
SendAuth.Resp aures = (SendAuth.Resp) baseResp;
//获取code
String code = aures.code;
//请求获取UserInfo
getAccessToken(code);
Intent in = new Intent(WXEntryActivity.this, WebActivity.class);
in.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(in);
overridePendingTransition(0, 0);
finish();
}
}
if (type == WXSHARE) {
CommonUtils.showToast(this, "分享成功");
}
break;
//用户取消授权
case BaseResp.ErrCode.ERR_USER_CANCEL:
result = R.string.errcode_cancel;
if (type == WXLOGIN) {
finish();
}
if (type == WXSHARE) {
CommonUtils.showToast(this, "分享已取消");
}
break;
//用户拒绝授权
case BaseResp.ErrCode.ERR_AUTH_DENIED:
result = R.string.errcode_deny;
break;
default:
result = R.string.errcode_unknown;
break;
}
}
示例12: onResp
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void onResp(final BaseResp resp) {
mAuthListener = WechatAuthManager
.getPlatformActionListener();
mShareListener = WechatShareManager.getPlatformActionListener();
switch (resp.errCode) {
case BaseResp.ErrCode.ERR_OK:
if (resp.getType() == TYPE_LOGIN) {
final String code = ((SendAuth.Resp) resp).code;
WechatApiService api = getApiService();
api.getAccessToken(ShareSDK.getInstance().getWechatAppId(), ShareSDK.getInstance().getWechatSecret(), code, "authorization_code", new AccessTokenCallback(mAuthListener, api));
} else {
mShareListener.onSuccess();
}
break;
case BaseResp.ErrCode.ERR_USER_CANCEL:
if (resp.getType() == TYPE_LOGIN) {
if (mAuthListener != null) {
mAuthListener.onCancel();
}
} else {
mShareListener.onCancel();
}
break;
case BaseResp.ErrCode.ERR_SENT_FAILED:
if (resp.getType() == TYPE_LOGIN) {
if (mAuthListener != null) {
mAuthListener.onError();
}
} else {
mShareListener.onFaild();
}
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED:
if (resp.getType() == TYPE_LOGIN) {
if (mAuthListener != null) {
mAuthListener.onError();
}
Toast.makeText(mContext, R.string.auth_denied, Toast.LENGTH_SHORT).show();
}
break;
case BaseResp.ErrCode.ERR_UNSUPPORT:
break;
}
finish();
}
示例13: onResp
import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void onResp(BaseResp baseResp) {
if (ConstantsAPI.COMMAND_SENDAUTH == baseResp.getType()) {
switch (baseResp.errCode) {
case BaseResp.ErrCode.ERR_OK:
SendAuth.Resp localResp = (SendAuth.Resp) baseResp;
EventBus.getDefault().post(new ThirdPartLogin(localResp.code));
break;
case BaseResp.ErrCode.ERR_USER_CANCEL: //取消
break;
case BaseResp.ErrCode.ERR_AUTH_DENIED: //拒绝授权
break;
case BaseResp.ErrCode.ERR_UNSUPPORT://不支持的客户端
break;
case BaseResp.ErrCode.ERR_SENT_FAILED: //授权失败
break;
case BaseResp.ErrCode.ERR_COMM: //一般错误?
break;
}
}else if(ConstantsAPI.COMMAND_SENDMESSAGE_TO_WX == baseResp.getType()){ //发送消息(分享)
}
finish();
}