Reduced size of Twitter for Android lib

One of the biggest problem with the previous implementation was that it used both Oauth and Twitter4J, the end result was a big APK file.

I’ve changed the code (you can download it from here) and removed Oauth, I’m using now Twitter4J version 2.2.2 which has built in support for OAuth,

In addition a new method was added which enables you to retrieve an initialized twitter object with the correct access token. See example:

Twitter twitter = TwitterUtils.getTwitterObject(activity, consumerKey, consumerSecret);
// Indicates that user was not authenticated
if (twitter == null) {
	Log.e(Constants.TAG, "User is not twitter authenticated");
	Toast toast = Toast.makeText(activity, "Please authenticate yourself first.", Toast.LENGTH_SHORT);
	toast.show();
}
else {
	// User the twitter object to do your bidding.
}
Advertisements

Leave a comment

Filed under Twitter for Android

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s