1

I am trying to integrate twitter in my application. I want to authenticate user using twitter application if install in device and its not present open browser, just same as facebook SDK is doing.

I want to get user's access token for posting tweet, get follower list.

Currently i am using twitter4j library.

Any suggestion how can i achieve this.

asked Nov 4, 2014 at 11:36
3
  • fallow this Commented Nov 4, 2014 at 11:36
  • what you want to achieve.. means share (tweet) to your account? Commented Nov 4, 2014 at 11:37
  • Basically i need user's access token Commented Nov 4, 2014 at 11:41

1 Answer 1

2

Twitter just launched an official SDK that with only a few lines of code you have Sign in with Twitter working and with all alternate authentication flows implemented (having Twitter app installed, not installed, user cancelation, etc)

Check: http://t.co/fabric

Example:

private void setUpTwitterButton() {
 twitterButton = (TwitterLoginButton) findViewById(R.id.twitter_button);
 twitterButton.setCallback(new Callback<TwitterSession>() {
 @Override
 public void success(Result<TwitterSession> result) {
 // TODO: success flow
 }
 @Override
 public void failure(TwitterException exception) {
 // TODO: failure flow
 }
 });
}

The access token will be in the result object of success method above.

The Android docs are here: http://t.co/fabric-android

If you want to see a app sample with this SDK: https://github.com/twitterdev/cannonball-android

answered Nov 4, 2014 at 12:15
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.