当前位置: 首页>>代码示例>>Java>>正文


Java SendAuth.Req方法代码示例

本文整理汇总了Java中com.tencent.mm.sdk.modelmsg.SendAuth.Req方法的典型用法代码示例。如果您正苦于以下问题:Java SendAuth.Req方法的具体用法?Java SendAuth.Req怎么用?Java SendAuth.Req使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.tencent.mm.sdk.modelmsg.SendAuth的用法示例。


在下文中一共展示了SendAuth.Req方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: login

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
public void login(Callback callback) {
    IWXAPI iwxapi = init();
    if (iwxapi == null) {
        if (callback != null)
            callback.onFailed();
        return;
    }
    // 唤起微信登录授权
    SendAuth.Req req = new SendAuth.Req();
    req.scope = "snsapi_userinfo";
    req.state = "wechat_login";
    // 失败回调
    if (!iwxapi.sendReq(req) && callback != null) {
        callback.onFailed();
    } else {
        if (callback != null)
            callback.onSuccess();
    }
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:20,代码来源:OpenBuilder.java

示例2: onClick

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.btn_wx_login:
            if (MyApplication.isInstallWx) {
                btn_login.setText(R.string.wx_logining);
                SendAuth.Req req = new SendAuth.Req();
                req.scope = getString(R.string.scope);
                req.state = getString(R.string.state);
                MyApplication.api.sendReq(req);
            } else {
                CommonUtils.showToast(getApplicationContext(), getString(R.string.wx_not_install));
            }
            break;

        case R.id.tv_protocol:
            Intent intent = new Intent(IndexActivity.this, ProtocolActivity.class);
            startActivity(intent);
            break;
    }
}
 
开发者ID:JunGeges,项目名称:AliZhiBoHao,代码行数:22,代码来源:IndexActivity.java

示例3: requestOauthCode

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
/**
 * 第一步、获得授权的code
 */
public void requestOauthCode(IWXListener listener, String transaction) {
    if (!WXAPI.isWXAppInstalled()) {
        if (listener != null) {
            listener.wxUnInstall();
        }
        return;
    }
    //1.生成一个此链接的唯一标识,返回的时候会原封不动地返回回来
    Random random = new Random();
    int value = random.nextInt(1000) + 1;
    mTransaction = transaction;
    String state = mTransaction + value;
    //2.发出请求,获取code
    final SendAuth.Req req = new SendAuth.Req();
    req.scope = "snsapi_userinfo";
    req.state = state;
    req.transaction = mTransaction;
    WXAPI.sendReq(req);
}
 
开发者ID:pinguo-sunjianfei,项目名称:Android-Application-ZJB,代码行数:23,代码来源:WChatManager.java

示例4: login

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void login(final Activity activity, Bundle pararms, final LoginCallback callback) {
	DebugLog.d(TAG, "login()");
	
	this.callback = callback;
	
	IWXAPI wxapi = MyApp.getApp().getWXAPI();
	if (!wxapi.isWXAppInstalled()) {
           //提醒用户没有安装微信
		String uninstalled = activity.getResources().getString(R.string.WeixinLogin_uninstalled);
		CustomToast.makeText(activity,uninstalled, 2000).show();
           return;
       }
	
	 SendAuth.Req req = new SendAuth.Req();
     req.scope = "snsapi_userinfo";
     req.state = "wechat_sdk_demo";
     wxapi.sendReq(req);
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:20,代码来源:WeixinLogin.java

示例5: onWechatLogin

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
/**
 * 微信授权登录
 */
@Click(R.id.llWechatLogin)
void onWechatLogin() {
  /*  Log.i("LoginActivity", "微信授权登录");
    //AbToastUtil.showToast(mContext,"功能正在完善开发中...");
    Config.dialog = ProgressDialog.show(mContext, "提示", "正在请求跳转....");
    SHARE_MEDIA platform = SHARE_MEDIA.WEIXIN;
    umShareAPI = UMShareAPI.get(mContext);
    umShareAPI.doOauthVerify(this, platform, umAuthListener);*/
    if (Contact.isWeixinAvilible(this)) {
        progressDialog = AbDialogUtil.showProgressDialog(mContext, Global.LOADING_PROGRESSBAR_ID, "登录中");
        mLlWechatLogin.setEnabled(false);
        IWXAPI api = WXAPIFactory.createWXAPI(this, "wx747d053fa471eb15", true);

        api.registerApp("wx747d053fa471eb15");
        SendAuth.Req req = new SendAuth.Req();
        req.scope = "snsapi_userinfo";
        req.state = "wechat_sdk_demo_test";
        api.sendReq(req);
    } else {
        ToastUtils.show(this, "请安装微信");
    }
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:26,代码来源:LoginActivity.java

示例6: login

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
/**
 * 发出登陆请求
 * @param context
 */
public static void login(Context context) {

    if (!isWXAPPInstalled(context)) {
        Helper.showToast("请安装微信客户端");
    } else {
        if (!mWXAPI.isWXAppSupportAPI()) {
            Helper.showToast( "请升级微信客户端,不支持api!");
        } else {
            SendAuth.Req req = new SendAuth.Req();
            req.scope = "snsapi_userinfo";
            req.state = "none";
            mWXAPI.sendReq(req);
        }
    }

}
 
开发者ID:Moearly,项目名称:ZeaApp,代码行数:21,代码来源:ThirdWeiXinLoginApi.java

示例7: doLogin

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void doLogin(Activity activity, LoginListener listener, boolean fetchUserInfo) {
    final SendAuth.Req req = new SendAuth.Req();
    req.scope = SCOPE_USER_INFO;
    req.state = String.valueOf(System.currentTimeMillis());
    mIWXAPI.sendReq(req);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:WxLoginInstance.java

示例8: login

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
public static void login(Context context, IWXCallback callback, SocialInfo info) {
    if (!SocialSSOProxy.isTokenValid(context)) {
        WeChatSSOProxy.callback = callback;
        SendAuth.Req req = new SendAuth.Req();
        req.scope = info.getWeChatScope();
        WeChat.getIWXAPIInstance(context, info.getWechatAppId()).sendReq(req);
    }
}
 
开发者ID:yangjie127,项目名称:ESSocialSDK-master,代码行数:9,代码来源:WeChatSSOProxy.java

示例9: auth

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void auth(Activity activity) {
    ShareType = ShareConstant.AUTH;
    api = WXAPIFactory.createWXAPI(activity, BuildConfig.WECHAT_APP_ID, true);
    api.registerApp(BuildConfig.WECHAT_APP_ID);

    SendAuth.Req req = new SendAuth.Req();
    req.scope = "snsapi_userinfo";
    req.state = "mengwo_wx_login";

    api.sendReq(req);
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:13,代码来源:ShareWechat.java

示例10: authorize

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
public void authorize(Activity act, UMAuthListener listener) {
    if (TextUtils.isEmpty(this.WX_APPID) || TextUtils.isEmpty(this.WX_SECRET)) {
        Log.e("UMWXHandler", "Appid或者App secret为空,不能授权。请设置正确地Appid跟App Secret");
        return;
    }
    this.mAuthListener = listener;
    this.mAuthListener.onStart(this.isToCircle ? SHARE_MEDIA.WEIXIN_CIRCLE : SHARE_MEDIA
            .WEIXIN);
    this.isFromAuth = true;
    boolean isNotExpired = OauthHelper.isRefreshTokenNotExpired(act, SHARE_MEDIA.WEIXIN);
    if (!isNotExpired) {
        isNotExpired = OauthHelper.isRefreshTokenNotExpired(act, SHARE_MEDIA.WEIXIN_CIRCLE);
    }
    if (isNotExpired && this.mRefreshTokenAvailable) {
        String refreshToken = OauthHelper.getRefreshToken(act, SHARE_MEDIA.WEIXIN);
        if (TextUtils.isEmpty(refreshToken)) {
            refreshToken = OauthHelper.getRefreshToken(act, SHARE_MEDIA.WEIXIN_CIRCLE);
        }
        loadOauthData("https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=" + this
                .WX_APPID + "&grant_type=refresh_token&refresh_token=" + refreshToken);
        return;
    }
    SendAuth.Req req = new SendAuth.Req();
    req.scope = "snsapi_userinfo,snsapi_friend,snsapi_message";
    req.state = "none";
    this.mWXApi.sendReq(req);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:28,代码来源:UMWXHandler.java

示例11: auth

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
    public void auth(Activity activity, final AuthCallback callback) {
        mMmsApi = WXAPIFactory.createWXAPI(activity.getApplicationContext(), TENCENT_MMS_APP_ID, true);
        mMmsApi.registerApp(TENCENT_MMS_APP_ID);

//        activity.runOnUiThread(() -> {
            SendAuth.Req req = new SendAuth.Req();
            req.scope = WX_USERINFO_SCOPE;
            req.state = "crew_state_" + System.currentTimeMillis();
            mMmsApi.sendReq(req);
            Logger.d("UserSystem", "wechat sendReq");
//        });
    }
 
开发者ID:markzhai,项目名称:AndroidProjectFrom0,代码行数:14,代码来源:WechatAuth.java

示例12: auth

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public boolean auth(boolean requestUserInfo) {
	if (!super.auth(requestUserInfo))
		return false;
	SendAuth.Req req = new SendAuth.Req();
	req.scope = "snsapi_userinfo";
	req.state = "wechat_sdk_demo_test";
	getPlatform().getApi().sendReq(req);
	return true;
}
 
开发者ID:Joy-Whale,项目名称:EasyShare,代码行数:11,代码来源:WechatAuth.java

示例13: login

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void login(AuthListener authListener) {
    if (mIWXAPI != null) {
        final SendAuth.Req req = new SendAuth.Req();
        req.scope = SCOPE;
        req.state = STATE;
        mIWXAPI.sendReq(req);
        mAuthListener = authListener;
    }
}
 
开发者ID:henjue,项目名称:sharesdk,代码行数:11,代码来源:WechatAuthManager.java

示例14: openWxClient

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
/**
 * 调起微信客户端
 */
private void openWxClient() {
    if (mWxApi.isWXAppInstalled()) {
        SendAuth.Req req = new SendAuth.Req();
        req.scope = "snsapi_userinfo"; //作用域,snsapi_userinfo 获取用户信息
        req.state = RandomUtils.randomKey(8); //用于保持请求和回调的状态,授权请求后原样带回给第三方
        mWxApi.sendReq(req);
    } else {
        ToastUtils.getInstance().showInfo(mRootView, R.string.wx_not_install);
    }
}
 
开发者ID:longtengyiyu,项目名称:AndroidBaseAppCodeFramework,代码行数:14,代码来源:SignFragment.java

示例15: onClick

import com.tencent.mm.sdk.modelmsg.SendAuth; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    switch (v.getId()){
        case R.id.tvRight:
            Jump(RegisterActivity.class);
            break;
        case R.id.tvForget:
            Jump(ForgetActivity.class);
            break;
        case R.id.btnLogin:

            if (StringUtils.isEmpty(etName.getText().toString())){
                ToastUtils.show(LoginActivity.this,"请输入用户名");
                return;
            }

            if (StringUtils.isEmpty(etPwd.getText().toString())){
                ToastUtils.show(LoginActivity.this,"请输入密码");
                return;
            }

            params=new RequestParams();
            params.put("user.username",etName.getText().toString());
            params.put("user.password",etPwd.getText().toString());
            params.put("user.clientId", Contact.deviceToken);
            post("user/login",params);

            break;
        case R.id.tvWechat:
            if (Contact.isWeixinAvilible(this)) {
                //微信登录发起
                IWXAPI api = WXAPIFactory.createWXAPI(this, "wxce3287b52eccea84", true);

                api.registerApp("wxce3287b52eccea84");
                SendAuth.Req req = new SendAuth.Req();
                req.scope = "snsapi_userinfo";
                req.state = "wechat_sdk_demo_test";
                api.sendReq(req);
            } else {
                ToastUtils.show(this, "请安装微信");
            }
            break;
        case R.id.tvQQ:
            LoginQQ();
            break;
        case R.id.tvShort:
            Jump(CodeLoginActivity.class);
            break;
    }
}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:51,代码来源:LoginActivity.java


注:本文中的com.tencent.mm.sdk.modelmsg.SendAuth.Req方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。