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


Java AuthInfo类代码示例

本文整理汇总了Java中com.sina.weibo.sdk.auth.AuthInfo的典型用法代码示例。如果您正苦于以下问题:Java AuthInfo类的具体用法?Java AuthInfo怎么用?Java AuthInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: sinaLoginClick

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
private void sinaLoginClick() {
    LetvLogApiTool.getInstance().saveExceptionInfo("sina登录开始 Current Time :" + StringUtils.getTimeStamp());
    if (NetworkUtils.isNetworkAvailable()) {
        LogInfo.LogStatistics("新浪微博注册");
        String pageId = this.mIsLoginPage ? PageIdConstant.loginPage : PageIdConstant.registerPage;
        StatisticsUtils.statisticsActionInfo(this.mActivity, pageId, "0", this.mIsLoginPage ? "c72" : "c82", null, 2, "ref=" + pageId + "_072_2");
        if (SinaWeiboUtils.isWeiboAppSupportAPI(this.mActivity, "3830215581", false)) {
            this.mWeiboAuth = new AuthInfo(this.mActivity, "3830215581", "http://m.letv.com", "email,direct_messages_read,direct_messages_write,friendships_groups_read,friendships_groups_write,statuses_to_me_read,follow_app_official_microblog,invitation_write");
            this.mSsoHandler = new SsoHandler(this.mActivity, this.mWeiboAuth);
            this.mSsoHandler.authorize(new AuthListener(this));
            return;
        }
        LetvOpenIDOAuthLoginActivity.launch(this.mActivity, ShareUtils.getSinaLoginUrl(), getResources().getString(2131100352));
        return;
    }
    ToastUtils.showToast(2131101012);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:ThirdPartLoginLayout.java

示例2: shareToWeibo

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public static void shareToWeibo(String transaction, Activity activity, String title, String summary, Bitmap img) {
    ImageObject imageObject = new ImageObject();
    imageObject.imageData = bmpToByteArray(img);

    TextObject textObject = new TextObject();
    textObject.text = title + "\n" + summary + Constants.SUMMARY;

    WeiboMultiMessage message = new WeiboMultiMessage();
    message.textObject = textObject;
    message.imageObject = imageObject;

    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = transaction;
    request.multiMessage = message;

    AuthInfo authInfo = new AuthInfo(activity, Constants.WB_APP_ID, Constants.WB_REDIRECT_URL, Constants.WB_SCOPE);
    Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(APP_CONTEXT);
    String token = "";
    if (accessToken != null) {
        token = accessToken.getToken();
    }
    IWeiboShareAPI api = getWbApi();
    api.sendRequest(activity, request, authInfo, token, weiboAuthListener);
}
 
开发者ID:qiujuer,项目名称:UPMiss,代码行数:25,代码来源:Share.java

示例3: weiboLogin

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
/**
 * 微博登陆
 */
private void weiboLogin(){
    mAuthInfo = new AuthInfo(this, Constants.WEIBO_APP_KEY, Constants.WEIBO_REDIRECT_URL, Constants.WEIBO_SCOPE);
    mSsoHandler = new SsoHandler(this, mAuthInfo);
    // Web授权
    //mSsoHandler.authorizeWeb(new LoginWeiboAuthListener());
    // SSO授权
    //mSsoHandler.authorizeClientSso(new LoginWeiboAuthListener());
    // All in one
    // 此种授权方式会根据手机是否安装微博客户端来决定使用sso授权还是网页授权,
    // 如果安装有微博客户端 则调用微博客户端授权,否则调用Web页面方式授权
    try {
        mSsoHandler.authorize(new LoginWeiboAuthListener());
    }catch (Exception e){
        Log.e(TAG, "weibo login exception: " + e.getMessage());
    }
}
 
开发者ID:zjupure,项目名称:SneezeReader,代码行数:20,代码来源:MainActivity.java

示例4: onCreate

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    Intent intent = getIntent();
    if(intent == null){
        finish();
        return;
    }
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
    }
    inflater = LayoutInflater.from(this);

    mTencent = Tencent.createInstance(Globe.QQ_APP_ID, this);
    mAuthInfo = new AuthInfo(this, Globe.SINA_APP_KEY, Globe.SINA_REDIRECT_URL, null);
    mSsoHandler = new SsoHandler(this, mAuthInfo);
    mIWeiboShareAPI =  WeiboShareSDK.createWeiboAPI(this, Globe.SINA_APP_KEY);
    mIWeiboShareAPI.registerApp();
}
 
开发者ID:x251089003,项目名称:EveryXDay,代码行数:24,代码来源:ToolbarControlDetailListViewActivity.java

示例5: init

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
protected void init() {
    // 设置Logo 1/4 处
    tvLoginTitle = (TextView) findViewById(R.id.tv_login_title);
    tvLoginTitle.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) tvLoginTitle.getLayoutParams();
            layoutParams.setMargins(0, Math.round(App.SCREEN_HEIGHT / 4f), 0, 0);
            tvLoginTitle.setLayoutParams(layoutParams);
        }
    });

    // 快速授权时,请不要传入 SCOPE,否则可能会授权不成功
    mAuthInfo = new AuthInfo(this, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
    mSsoHandler = new SsoHandler(LoginActivity.this, mAuthInfo);

    // SSO 授权, 仅Web
    findViewById(R.id.btn_login).setOnClickListener(
        new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mSsoHandler.authorizeWeb(new AuthListener());
            }
        });
}
 
开发者ID:a464538715,项目名称:WeiBo_LH,代码行数:26,代码来源:LoginActivity.java

示例6: init

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public void init(JSONArray json, CallbackContext cbContext) {
	appKey = getData(json, "appKey");
	String redirectURI = getData(json, "redirectURI");
	String scope = getData(json, "scope");
	if (scope == null) {
		scope = "all";
	}
	try {
		mAuthInfo = new AuthInfo(this.cordova.getActivity()
				.getApplicationContext(), appKey, redirectURI, scope);
		// mSsoHandler = new SsoHandler(WBAuthActivity.this, mAuthInfo);

		// mWeiboAuth = new
		// WeiboAuth(this.cordova.getActivity().getApplicationContext(),
		// appKey, redirectURI, scope);
		PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
		callbackContext.sendPluginResult(pluginResult);
	} catch (Exception e) {
		e.printStackTrace();
		callbackContext.error(getErrorObject(e.getMessage()));
	}
}
 
开发者ID:mrichie,项目名称:pg-weibo,代码行数:23,代码来源:QyWeibo.java

示例7: WeiboLoginInstance

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public WeiboLoginInstance(Activity activity, LoginListener listener, boolean fetchUserInfo) {
    super(activity, listener, fetchUserInfo);
    AuthInfo authInfo = new AuthInfo(activity, ShareManager.CONFIG.getWeiboId(),
            ShareManager.CONFIG.getWeiboRedirectUrl(), ShareManager.CONFIG.getWeiboScope());
    mSsoHandler = new SsoHandler(activity, authInfo);
    mLoginListener = listener;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:WeiboLoginInstance.java

示例8: allInOneShare

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
private void allInOneShare(final Context context, SendMultiMessageToWeiboRequest request) {

        AuthInfo authInfo = new AuthInfo(context, mSinaAppKey, REDIRECT_URL, SCOPE);
        Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(context);
        String token = "";
        if (accessToken != null) {
            token = accessToken.getToken();
        }

        mSinaAPI.sendRequest((Activity) context, request, authInfo, token, new WeiboAuthListener() {

            @Override
            public void onWeiboException(WeiboException arg0) {
                Toast.makeText(context, context.getString(
                        R.string.share_failed), Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onComplete(Bundle bundle) {
                Oauth2AccessToken newToken = Oauth2AccessToken.parseAccessToken(bundle);
                AccessTokenKeeper.writeAccessToken(context, newToken);
                Toast.makeText(context, context.getString(
                        R.string.share_success), Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onCancel() {
                Toast.makeText(context, context.getString(
                        R.string.share_cancel), Toast.LENGTH_SHORT).show();

            }
        });

    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:WeiboShareManager.java

示例9: login

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
@Override
public void login(PlatformActionListener platformActionListener) {
    mPlatformActionListener = platformActionListener;
    AccessTokenKeeper.clear(mContext);
    mAuthInfo = new AuthInfo(mContext, mSinaAppKey, mRedirectUrl, SCOPE);
    mSsoHandler = new SsoHandler((Activity) mContext, mAuthInfo);
    mSsoHandler.authorize(new AuthListener());

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:WeiboLoginManager.java

示例10: onCreate

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.inject(this);
    mAuthInfo = new AuthInfo(this, Constant.APP_KEY, Constant.REDIRECT_URL, Constant.SCOPE);
    mLoginBtnDefault.setWeiboAuthInfo(mAuthInfo, mLoginListener); // 为按钮设置授权认证信息
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:9,代码来源:LoginActivity.java

示例11: shareToWeibo

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
private void shareToWeibo() {
    mAccessToken = AccessTokenKeeper.readAccessToken(mContext);
    if (mAccessToken != null) {
        StatusesAPI statusAPI = new StatusesAPI(mContext, Constants.WEIBO_APPKEY, mAccessToken);
        statusAPI.update(shareText + mContext.getResources().getString(R.string.shareDescription) + shareLink, "0.0", "0.0", weiboListener);
        //statusAPI.uploadUrlText("分享一个音乐播放器,http://www.lingjutech.com", "http://tp3.sinaimg.cn/1706684510/50/22818070132/1", "", "0.0", "0.0", weiboListener);
    } else {
        AccessTokenKeeper.clear(mContext);
        Log.i(TAG, "Context=" + mContext);
        AuthInfo authInfo = new AuthInfo(mContext, Constants.WEIBO_APPKEY, Constants.REDIRECT_URL, Constants.SCOPE);
        //			WeiboAuth weiboAuth = new WeiboAuth(mContext, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
        mSsoHandler = new SsoHandler((Activity) mContext, authInfo);
        mSsoHandler.authorize(new AuthListener());
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:16,代码来源:BaseDialog.java

示例12: onClick

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
@Override
public void onClick(View v) {
    if (v.getId() == R.id.signin_btn) {  // sign in
        AuthInfo authInfo = new AuthInfo(this, WeiboData.APP_KEY, WeiboData.REDIRECT_URL, WeiboData.SCOPE);
        ssoHandler = new SsoHandler(this, authInfo);
        ssoHandler.authorize(this);

    } else if (v.getId() == R.id.github_btn) {
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/sherlockchou86"));
        startActivity(browserIntent);
    }
}
 
开发者ID:sherlockchou86,项目名称:yphoto,代码行数:13,代码来源:SignInActivity.java

示例13: shareTo

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
private static void shareTo(final Context context, final String appKey, final String redirectUrl, final String scop, final String title, final String desc,
                            final String imageUrl, final String shareUrl, final WeiboAuthListener listener) {
    new Thread(new Runnable() {
        @Override
        public void run() {
            WeiboMultiMessage msg = new WeiboMultiMessage();
            TextObject text = new TextObject();
            text.text = desc;
            msg.textObject = text;
            WebpageObject web = new WebpageObject();
            web.description = desc;
            byte[] thumb = SocialUtils.getHtmlByteArray(imageUrl);
            if (null != thumb)
                web.thumbData = SocialUtils.compressBitmap(thumb, 32);
            else
                web.thumbData = SocialUtils.compressBitmap(SocialUtils.getDefaultShareImage(context), 32);
            web.actionUrl = shareUrl;
            web.identify = imageUrl;
            web.title = title;
            msg.mediaObject = web;

            SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
            request.transaction = String.valueOf(System.currentTimeMillis());
            request.multiMessage = msg;

            AuthInfo authInfo = new AuthInfo(context, appKey, redirectUrl, scop);
            Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(context);
            String token = "";
            if (accessToken != null) {
                token = accessToken.getToken();
            }
            getInstance(context, appKey).sendRequest((Activity) context, request, authInfo, token, listener);
        }
    }).start();

}
 
开发者ID:yangjie127,项目名称:ESSocialSDK-master,代码行数:37,代码来源:WeiboShareProxy.java

示例14: SsoHandler

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public SsoHandler(Activity activity, AuthInfo weiboAuthInfo) {
    this.mAuthActivity = activity;
    this.mAuthInfo = weiboAuthInfo;
    this.mWebAuthHandler = new WebAuthHandler(activity, weiboAuthInfo);
    this.mWeiboInfo = WeiboAppManager.getInstance(activity).getWeiboInfo();
    AidTask.getInstance(this.mAuthActivity).aidTaskInit(weiboAuthInfo.getAppKey());
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:8,代码来源:SsoHandler.java

示例15: startAuth

import com.sina.weibo.sdk.auth.AuthInfo; //导入依赖的package包/类
public static void startAuth(Context context, String url, AuthInfo authInfo, WeiboAuthListener listener) {
    AuthRequestParam reqParam = new AuthRequestParam(context);
    reqParam.setLauncher(BrowserLauncher.AUTH);
    reqParam.setUrl(url);
    reqParam.setAuthInfo(authInfo);
    reqParam.setAuthListener(listener);
    Intent intent = new Intent(context, WeiboSdkBrowser.class);
    intent.putExtras(reqParam.createRequestParamBundle());
    context.startActivity(intent);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:11,代码来源:WeiboSdkBrowser.java


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