本文整理汇总了Java中com.sina.weibo.sdk.auth.sso.SsoHandler类的典型用法代码示例。如果您正苦于以下问题:Java SsoHandler类的具体用法?Java SsoHandler怎么用?Java SsoHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SsoHandler类属于com.sina.weibo.sdk.auth.sso包,在下文中一共展示了SsoHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sinaLoginClick
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的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);
}
示例2: login
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
public void login(Activity activity, SsoHandler ssoHandler, final OnLoginListener loginListener) {
this.loginListener = loginListener;
if (loginListener == null)
return;
WbAuthHelper.auth(activity, ssoHandler, new WbAuthHelper.OnAuthOverListener() {
@Override
public void onAuth(Oauth2AccessToken token) {
getUserInfo(token);
}
@Override
public void onException(SocialException e) {
loginListener.onFailure(e);
}
@Override
public void onCancel() {
loginListener.onCancel();
}
});
}
示例3: onCreate
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wb_login);
ButterKnife.bind(this);
if (BaseConfig.sAddAccountMode) {
mTvMsg.setText(R.string.add_another_account);
} else {
mTvMsg.setText(R.string.has_not_logined);
}
// 快速授权时,请不要传入 SCOPE,否则可能会授权不成功
// 高级授权
mAuthInfo = new AuthInfo(this, SinaConsts.WEICO_APP_KEY, SinaConsts.WEICO_REDIRECT_URL,
SinaConsts.SCOPE, SinaConsts.WEICO_PACKAGE_NAME);
// 普通授权
// mAuthInfo = new AuthInfo(this, SinaConsts.APP_KEY, SinaConsts.REDIRECT_URL,
// SinaConsts.SCOPE, App.getInstance().getPackageName());
mSsoHandler = new SsoHandler(this, mAuthInfo);
}
示例4: onActivityResult
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == Constants.REQUEST_LOGIN
|| requestCode == Constants.REQUEST_APPBAR) {
IUiListener listener = LoginByQQ.getmUiListener();
if (listener != null) {
Tencent.onActivityResultData(requestCode, resultCode, data,
listener);
}
}
SsoHandler ssoHandler = LoginByWB.getmSsoHandler();
if (ssoHandler != null) {
ssoHandler.authorizeCallBack(requestCode, resultCode, data);
}
}
示例5: allInOneShare
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
private void allInOneShare(final WeiboMultiMessage weiboMessage) {
final String token = getToken();
if (TextUtils.isEmpty(token)) {
mWeiboMessage = weiboMessage;
Log.d(TAG, "authorize when allInOneShare");
mSsoHandler = new SsoHandler((Activity) getContext());
mSsoHandler.authorize(mAuthListener);
} else {
mWeiboMessage = null;
mSsoHandler = null;
doOnMainThread(new Runnable() {
@Override
public void run() {
postProgressStart();
Log.d(TAG, "share message when allInOneShare");
mShareHandler.shareMessage(weiboMessage, false);
}
});
}
}
示例6: weiboLogin
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的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());
}
}
示例7: onCreate
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的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();
}
示例8: init
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的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());
}
});
}
示例9: initLoginViews
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
private void initLoginViews() {
TextView hintView = (TextView) findViewById(R.id.token_hint);
hintView.setMovementMethod(new ScrollingMovementMethod());
// 创建微博实例
mWeiboAuth = new WeiboAuth(this, com.bpok.sina.sdk.Constants.APP_KEY,
Constants.REDIRECT_URL, Constants.SCOPE);
// 从 SharedPreferences 中读取上次已保存好 AccessToken 等信息,
// 第一次启动本应用,AccessToken 不可用
mAccessToken = AccessTokenKeeper.readAccessToken(this);
if (mAccessToken.isSessionValid()) {
updateTokenView(true);
}
loginButton = (LoginButton) findViewById(R.id.btn_login);
loginButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
mSsoHandler = new SsoHandler(Login.this, mWeiboAuth);
mSsoHandler.authorize(new AuthListener());
}
});
}
示例10: WeiboLoginInstance
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的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;
}
示例11: login
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的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());
}
示例12: shareToWeibo
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的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());
}
}
示例13: onClick
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的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);
}
}
示例14: login
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
public static SsoHandler login(Activity context, String appName, String title, String content, String imgUrl, String playUrl, String from, int mode, String staticsId, String fragId) {
if (isLogin(context) == 1 || isLogin2(context)) {
SharePageEditActivity.launch((Context) context, 1, content, playUrl, "", mode, staticsId, fragId);
if (context != null) {
context.finish();
}
return null;
}
SsoHandler mSsoHandler = new SsoHandler(context, new AuthInfo(context, "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"));
mSsoHandler.authorize(new 5(context, content, playUrl, mode, staticsId, fragId));
return mSsoHandler;
}
示例15: auth
import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入依赖的package包/类
@Override
public void auth(Activity activity) {
ShareType = ShareConstant.AUTH;
mAccessToken = new Oauth2AccessToken();
mAuthInfo = new AuthInfo(activity, BuildConfig.SINA_APP_ID, REDIRECT_URL, null);
mSsoHandler = new SsoHandler(activity, mAuthInfo);
authWrap = new AuthWrap();
authWrap.context = activity;
authWrap.authListener = new AuthListener();
mSsoHandler.authorize(authWrap.authListener);
}