0

Sorry for my english. I cant understand why I can't authorize in app. I use twitter documentation, but when I input login and password in twitter it nothing happens, callback in code not work.

Sorry about link in image, I have not 15 reputation

My settings in twitter:

image http://take.ms/SQcRO

When I click this button it nothing happens:

image http://take.ms/4Xo9R

My code:

  TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
    Fabric.with(this, new Twitter(authConfig));
    setContentView(R.layout.activity_main);

    status = (TextView)findViewById(R.id.status);
    status.setText("Status: Ready");

    loginButton = (TwitterLoginButton) findViewById(R.id.twitter_login_button);
    loginButton.setCallback(new Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> result) {
            Log.e("success", "success");
            // The TwitterSession is also available through:
            // Twitter.getInstance().core.getSessionManager().getActiveSession()
            TwitterSession session = result.data;
            // TODO: Remove toast and use the TwitterSession's userID
            // with your app's user model
            String msg = "@" + session.getUserName() + " logged in! (#" + session.getUserId() + ")";
            Log.e("msg", msg);
            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
        }

        @Override
        public void failure(TwitterException exception) {
            status.setText("Status: Login Failed");
            Toast.makeText(getApplicationContext(), exception.toString(), Toast.LENGTH_SHORT).show();
            Log.d("error", "Login with Twitter failure", exception);
        }
    });
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    // Make sure that the loginButton hears the result from any
    // Activity that it triggered.
    loginButton.onActivityResult(requestCode, resultCode, data);
}

In debugger not enters in this line: loginButton.onActivityResult(requestCode, resultCode, data);

I don't know why it is not working.

Saumik Bhattacharya
  • 891
  • 1
  • 12
  • 28
b1065579
  • 155
  • 1
  • 1
  • 9

0 Answers0