Hello guys!

Today I am going to show you how to integrate Twitter in Android using Fabric SDK.

First of all go to Fabric and Sign Up for an account if you haven’t already have one.

The open your project. I already have set up a simple layout and written their references to the buttons and Listeners in MainActivity.

After that being done. Click on your project Settings, then plugin.

Then Click Browse repositories. After that type in Fabric and Install Fabric For Android Studio.

After Android Studio reopens. In top of your bar click the Fabric Icon. It will open a window on right side. Click on the power button. It will ask you for your Fabric login credentials. Enter them and log in.

When login completes it will create a project and will show your project package name. Select it,  then Next.

On new screen it will list all the Kits provided by Fabric, select Twitter then on next page select Install.

It will ask you to create twitter account, (if you already have one you’ll need to add its credentials). For now click Create Account.

Next, it will ask you to show you the changes it will apply to your project. Click Apply.

Create two variables, once gradle finishes syncing. Don’t forget to add onActivityResult in your class.

Then in your Login Button listener. call the following method.

Lastly, in your Logout Button listener, do the following.

Run your project. Click twitter icon. Then Allow.

You’ll get your username, name, profile picture link and user id as soon as you’re logged in.

Your Image url will be something like “734074822397943809/nWcfwCDj_normal.jpg”. If you want the original picture, you’ll need to remove the substring _normal and make it like “734074822397943809/nWcfwCDj.jpg” to get the original size picture.

That’s all for the day.
If you have any question, leave a comment.
Link to project on Github.
See you all next time. 🙂



Aaqib is an enthusiastic programmer with the love of Swift and anything that looks like Swift i.e Kotlin. He loves writing code in Swift, and exploring new technology and platforms. He likes to listen to old music. When he is not writing code, he's probably spend his time watching movies, tv-shows or anime, or either doing some research for writing the next article. He started Kode Snippets in 2015.

Leave a Reply

Your email address will not be published. Required fields are marked *