コード例 #1
0
  @ReactMethod
  public void login(final Callback callback) {

    mTwitterAuthClient.authorize(
        (Activity) mActivityContext,
        new com.twitter.sdk.android.core.Callback<TwitterSession>() {

          @Override
          public void success(Result<TwitterSession> twitterSessionResult) {
            // Toast.makeText(mActivityContext, twitterSessionResult.toString(),
            // Toast.LENGTH_SHORT).show();
            callback.invoke(getCurrentToken(null));
          }

          @Override
          public void failure(TwitterException e) {
            e.printStackTrace();
            // Toast.makeText(mActivityContext, "Failed to connect to Twitter " + e.getMessage(),
            // Toast.LENGTH_SHORT).show();
            callback.invoke(null);
          }
        });
  }
コード例 #2
0
 public void handleActivityResult(final int requestCode, final int resultCode, final Intent data) {
   mTwitterAuthClient.onActivityResult(requestCode, resultCode, data);
 }
コード例 #3
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    authClient.onActivityResult(requestCode, resultCode, data);
  }