コード例 #1
0
ファイル: OAuthActivity.java プロジェクト: Rushera/passwdsafe
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(getContentView());
    registerReceiver(mConnectedReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));

    Intent intent = getIntent();
    mClientId = intent.getStringExtra(BoxConstants.KEY_CLIENT_ID);
    mClientSecret = intent.getStringExtra(BoxConstants.KEY_CLIENT_SECRET);
    mDeviceId = intent.getStringExtra(BoxConstants.KEY_BOX_DEVICE_ID);
    mDeviceName = intent.getStringExtra(BoxConstants.KEY_BOX_DEVICE_NAME);
    mRedirectUrl = intent.getStringExtra(BoxConstants.KEY_REDIRECT_URL);
    boolean loginViaBoxApp = intent.getBooleanExtra(LOGIN_VIA_BOX_APP, false);
    authType = loginViaBoxApp ? AUTH_TYPE_APP : AUTH_TYPE_WEBVIEW;
    apiCallStarted.getAndSet(false);
    mSession = (BoxSession) intent.getSerializableExtra(EXTRA_SESSION);
    if (mSession != null) {
      mSession.setApplicationContext(getApplicationContext());
    } else {
      mSession = new BoxSession(this, null, mClientId, mClientSecret, mRedirectUrl);
      mSession.setDeviceId(mDeviceId);
      mSession.setDeviceName(mDeviceName);
    }
  }