How to Get Started With Twitter's Fabric

Twitter used its first Flight Developer’s Conference in San Francisco in October to announce a new suite of utilities designed to deliver richer integration between Twitter and mobile apps, dubbed Fabric. Fabric is an aggregation of Twitter SDK updates and utilities from the recently acquired lightweight Crashlytics crash-reporting framework and various distribution and analytics tools. We will go through each of the Fabric tools and show you how to get started with Fabric.

What Is Crashlytics?

The first part of the suite comes from Crashlytics, which Twitter acquired in early 2013 as part of its strategy push to build the mobile Twitter development community. Crashlytics is better known for its core product, the self-named Crashlytics a lightweight crash-reporting framework, which is easy to install and use out of the box.

The Crashlytics Kit

The lightweight crash-reporting tool allows you to conveniently track and monitor each release of your app, on both iOSTrack this Framework/Library and AndroidTrack this Framework/Library, and catch all crashes, providing insights, such as historical stack unwinding to determine historically what the culprit is, along with the state of the device. It provides on-device symbolication, a way to make sense of the crash stack, and correlate traces with specific lines in your codebase.

Why Use Crashlytics?

Rather than having to spend time integrating another third-party crash-monitoring tool, Crashlytics is dead simple to install and use and made even more beneficial when it’s included as part of the Fabric suite, allowing you to install all the tools in the single downloadable MAC installation.

You get the added benefit of real-time reporting, being alerted to new issues as they happen, with the ability to calibrate the amount of reporting noise returned. What you are finally presented with is an elegant, informative dashboard, showing device usage along with the associated crashes.

Beautiful, Insightful Reports

The tool consists of an interactive desktop utility app and framework, and by following a few steps, you are able to conveniently track and monitor each release of your app on both iOS and Android and catch all crashes, providing insight through historical stack unwinding to determine historically what the culprit is, along with the state of the device.

What I enjoy with Crashlytics is that it allows developers to integrate crash reporting with various task-management tools, such as Asana.

Crashlytics’ Other Useful Tools

Crashlytics, buoyed by the great reception it received for being one of the simplest-to-install crash-monitoring tools, branched out with other useful associated tools. One of them is Beta distribution; the other is Answers.

Seeing an obvious customer pain in being able to distribute mobile apps, Beta distribution was introduced, but it goes beyond providing convenience to distribute to testers; it also seeks to re-emphasize your brand and color theme. When it automates the sending of new distribution builds, the email template matches your app’s icon colors and schemes to provide brand uniformity. Testers also get in-app notifications when updates are available.

Monitor the Tester Lifecycle

Beta distribution, as expected, integrates with Crashlytics, so you can associate issues with specific crashes that occur. One thing I really appreciate is that Beta brings attention to the development team to attend to the most highly visible and impacted issues first.

Rounding off the Crashlytics portion of Fabric is Answers, the company’s answer to analytics. As you have seen, we can now track crashes and the distribution of your app to testers during beta, but it’s also vital to understand how your app is used (or underused) even when the users don't experience crashes. Bundled with Fabric with no extra installation step required, Answers gives you better insight into “your app’s key growth and retention metrics — with no impact on performance,” according to Twitter.

Answers

From a higher-level dashboard to granular details on specific metrics, you are able to view specific aggregated information on important measurables, such as Daily Active Users, Top Builds, Time in App Per User and even Percentage of Crash-Free Users. Answers also integrates with Crashlytics to correlate the crash metrics with specific crash stacks, to get to the bug immediately.

As you can see, either through the sum of the three utilities or by cherry-picking one or two, you get convenient tools at your fingertips, with the one easy installation.

How Do I Integrate Fabric and Crashlytics?

Installing Fabric is straightforward. You choose whether to use XCode, Android Studio, Eclipse or IntelliJ, and follow the interactive plug-in prompts that will guide you to open up your IDE, and it will automatically link the appropriate frameworks and set the appropriate configuration to start using your app.

What Are Twitter Kit and Digits?

The second part of Fabric, and by no means any less significant, is the impressive overhaul of the Twitter SDK, now renamed Twitter Kit. The reborn Twitter Kit allows developers to authenticate users through Twitter’s REST API, with the latest iteration affording developers to implement it with extreme ease, as you will see shortly. Digits is a phone number-based registration and login API that protects the user’s social history.

What Is Twitter Kit?

Similar to using Facebook’s Signing with Facebook or Google+ Sign-In authentication mechanisms, Twitter is also pushing its authentication API, allowing users to sign in using their familiar Twitter credentials, rather than remembering a separate set of usernames and passwords.

Implementing Twitter’s credentials consolidation gateway, developers are rewarded with the insights of the authenticated user’s Twitter profile, including tweets, photos and followers in his or her network, which can be leveraged to create viral engagement campaigns.

How Do I integrate Twitter Kit Into my App?

If you’ve already installed the Fabric app, you are ready to go, and Twitter has already created a Twitter Application, setting up your environment to start implementing their SDK.

For this demonstration, we will work with the iOS version of the SDK, but if you are more interested in the Android version, please consult Twitter’s SDK documentation.

The first thing we are going to do is construct the logic required to log in via Twitter’s APIs. Twitter’s SDK will first try to use the Accounts.framework to authenticate the user, relying on the familiar built-in framework Apple provides. The fallback if that fails is to present the OAuth sequence, which automatically persists the credentials into the iOS “System Accounts,” providing as a callback: * Twitter Session Token; * Secret Key; * Username; and * user id.

Logging in can be implemented in Objective-C by simply creating a TWTRLoginButton instantiation, as follows:

TWTRLogInButton* button =  [TWTRLogInButton

                                 buttonWithLogInCompletion:

                                 ^(TWTRSession* session, NSError* error) {
//We test for whether the session object is populated, in which case we have an active session, otherwise we can assume an error has occured.
}];

Using Twitter’s self-generated button, you will get in the view, a UIButton subclass that you can add to your view hierarchy:

The button that is generated

Accessing authenticated user tweets can be accomplished just as rudimentarily, without having to even get your hands dirty with JSON responses. You can take advantage of the convenient TWTRTweetView, which can be styled and customized according to your liking.

[[[Twitter sharedInstance] APIClient] loadTweetWithID:@"xx"
                                       completion:^(TWTRTweet *tweetFeed,
                                                    NSError *error) {
if (tweetFeed) { //if we have tweets to display, we create a TweetView

    TWTRTweetView *feedView = [[TWTRTweetView alloc]
                                initWithTweet:tweetFeed]; 
     //add the view to your hierarchy
} else {
    NSLog(@"Failure to load tweet because: %@",
          [error localizedDescription]);
}
}];

You can also dive into tweet details or compose new tweets just as easily as part of Twitter Kit, with Twitter’s vision to work at a more abstract and less code-intensive layer, easing the learning curve for developers.

What Is Digits?

Digits takes the sign-in initiative one step further. Whereas we just saw how we could use Twitter’s standard API to provide authentication, while providing market insight into a Twitter user’s persona, Digits provides the encouragement to authenticate, while safeguarding or compromising identifiable user profile information.

Onboarding that Users Love & Trust

A user instead provides his or her Twitter-associated cell phone number, a unique identifier, as a means of registering and signing in without the burden of having to remember usernames and passwords. The user then gets a confirmation text message to ensure that that person is the user who has access to the phone associated with the number.

This is Twitter’s response to Facebook’s Anonymous API, which also caters to users who are more reluctant to expose any of their personal information.

An added benefit with Digits is that you are able to provide SMS-services to your customers without the added infrastructure and cost layout that traditionally only larger companies have been able to provide.

How Do I Integrate Digits Into my App?

Finally, to work with the privacy-conscious Digits, you need to keep in mind a few things. First, Digits relies on your existing Twitter user profile, where it matches your existing phone number associated with Twitter. When the SDK returns a successful association with the user’s phone number, it returns a "stable userID" that it will associate as your user record, generating an OAuth token for the persisting device. The reason is that phone numbers may change over time, which is why it cannot be relied upon to be consistent throughout.

To get started, the simplest way is to once again utilize the predefined button, DGTAuthenticateButton.

DGTAuthenticateButton *phoneButton =
    [DGTAuthenticateButton buttonWithAuthenticationCompletion:^

    (DGTSession *session, NSError *error) {
    //handle session and errors here 
}];

Of course, you could choose to implement your own custom button, and Twitter provides documentation to do that at a not-too-greater effort. Digits is only available on iOS and Android, with plans to extend it to the Web in the near future.

Summary

Twitter’s new Fabric is the product of its acquisition of Crashlytics, providing the benefits of the startup’s resourceful tools, from crash monitoring to distribution, and analytics, all with the simplicity of its installation utility app, to immediately get started with the tool.

Coupled with the Crashlytics set of utilities, Twitter has released Twitter Kit. Continuing in the theme of simplicity, you can now authenticate using consolidated and familiar credentials of your Twitter account, as well as access tweet feeds and compose new tweets with minimal code. Twitter also debuted Digits, the ability to authenticate with anonymity.

Pros:

  • Easy to install and use, with minimal code
  • Tools are free to use, unlike many third-party analytics and crash-monitoring tools
  • Diverse range of tools bundled into one suite
  • Easy authentication implementation, with the option of providing user anonymity
  • Digits provides SMS-services for free

Cons:

  • Twitter may not be as popular a tool as Facebook and Google, and may have limited appeal as a form of authentication.

Alternative products/services:

Ease of use: 4.5 of 5

Documentation: 4.5 of 5

Community Support: 4.5 of 5

Resources:

Doron Katz A keen passion for emerging technologies, practices and methodologies, Doron embraces the vision of lean development with continuous customer development. Consultant for various startups, as a Project and Product Manager, with a mobile engineering background in iOS, and over 10 years of professional web development experience.

Comments

Comments(1)

ullaskumar

Thank you for the details

information about the preconfigured number with an account makes me a little confused when it shows a create account button

if possible please clear.

 

Thanks

ullasrs2002@yahoo.co.in