Exemple #1
0
  /**
   * 当 SSO 授权 Activity 退出时,该函数被调用。
   *
   * @see {@link Activity#onActivityResult}
   */
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // SSO 授权回调
    // 重要:发起 SSO 登陆的 Activity 必须重写 onActivityResults
    if (mSsoHandler != null) {
      mSsoHandler.authorizeCallBack(requestCode, resultCode, data);
    }
  }
Exemple #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_welcom);

    Oauth2AccessToken oauth2AccessToken = AccessTokenKeeper.readAccessToken(this);
    if (oauth2AccessToken != null
        && !TextUtils.isEmpty(oauth2AccessToken.getUid())
        && !TextUtils.isEmpty(oauth2AccessToken.getToken())
        && !TextUtils.isEmpty(oauth2AccessToken.getRefreshToken())) {
      startActivity(new Intent(this, MainActivity.class));
      this.finish();
    } else {
      mAuthInfo = new AuthInfo(this, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
      mSsoHandler = new SsoHandler(WelcomActivity.this, mAuthInfo);
      mSsoHandler.authorize(new AuthListener());
    }
  }
Exemple #3
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   mSsoHandler.authorizeCallBack(
       requestCode, resultCode, data); // mSsoHandler回调方法,最终回调AuthListener里面的方法
 }