Test run with Fabric (Android)

android
fabric
twitter4j
twitterkit

#1

Was asked in a separate thread to post my feedback on using Fabric with Android for the first time, so here goes:

Pros:

  • Awesome Android Studio plugin, really neat
  • Easy install, handles dependencies

Cons:

  • Fabric for Android docs are lacking

More specifically, heres some issues I ran into when looking to simply grabbing some latest tweets from a few select Twitter users:

  1. https://docs.fabric.io/android/twitter/access-rest-api.html <-- mentions usable methods but no code examples.

  2. Mentions that guest authentication is recommended, but does not show exactly how to do guest Authentication.

Really looking for full code examples of common operations, as well as more verbose documentation. The lack of these makes 3rd party libs like Twitter4J much more appealing, as well as surprisingly easier to use. I have still yet to figure out how to do exactly what I want using the Fabric Twitter kit, but through mainly StackOverflow questions and answers was able to get the following working:

    TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
    Fabric.with(this, new Twitter(authConfig));

    TwitterCore.getInstance().logInGuest(new Callback<AppSession>() {
        @Override
        public void success(Result<AppSession> appSessionResult) {
            AppSession session = appSessionResult.data;
            TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient(session);
            twitterApiClient.getStatusesService().userTimeline(null, "elonmusk", 10, null, null, false, false, false, true, new Callback<List<Tweet>>() {
                @Override
                public void success(Result<List<Tweet>> listResult) {
                    for(Tweet tweet: listResult.data) {
                        Log.d("fabricstuff", "result: " + tweet.text + "  " + tweet.createdAt);
                    }
                }
                @Override
                public void failure(TwitterException e) {
                    e.printStackTrace();
                }
            });
        }
        @Override
        public void failure(TwitterException e) {
            e.printStackTrace();
        }
    });

Really looking foward to using Fabric if the framework becomes a tad easier to work with, mainly through code examples and documentation. I’m sure there is alot of things I missed, but this review was my thoughts after initially trying to use it. For the moment, Twitter4J seems like a simpler and more straightforward option, but I would love to be proven wrong.

Thanks for reading!


Android, getting new tweets from specific users
#2

Really appreciate all of the feedback on this. One of the keys thing we wanted to do with Fabric was make the authentication pieces a lot easier for developers. I’m curious, you mentioned more verbose documentation and more full code samples of common operations. Could you share a bit more about what you’re looking for? I work on our documentation, so I’d love to get more specifics that we could build out for you and other developers.


#3

Sure. I guess I could best answer this with an example. I’ve used Parse.com (a BaaS) for a couple apps and thought their docs were always really great, I almost never had to go to StackOverflow for basic operations. Take a look at this part of the documentation. For example, I know I want to save an object, so I click on Objects->Saving Objects. I get a complete relevant code example, as well as a surrounding explanation in chronological order.

For my use case, I went to here. As someone who hasnt used the Twitter api before, what should I be looking for? Clicking on “Access Twitters REST api” gives a few mentions of user timelines, but no examples. Clicking on “Show Timelines” in the sidebar provides some links to GET requests, and then 1-3 line snippets, with no indication of where or how to use the code. The examples are also interspersed with mentions of the Twitter UI kit, which if i just want to grab the Twitter data for my own Views is not helpful, and would probably be better used contained in its own section.

To summarize, I should be able to start reading the documentation and come across working code examples for relevant common operations that I could immediately use in my own code, with minor changes (keys etc…) if any. That and good Javadocs makes for perfect documentation, IMO.