Project Configuration

Add the API key and secret key inside a string.xml file. Without these keys, we will not be able to access the Twitter api services. The keys will  look like this:

<string name="twitter_consumer_key" translatable="false"><Your_api_key></string>
<string name="twitter_consumer_secret" translatable="false"><Your_secret_key></string>

Before we continue with any further settings, we need to add the Twitter dependency:

compile('com.twitter.sdk.android:twitter:3.2.0@aar') {
transitive = true
}

Here, after there is no much of change and we don't have any meta element tags to add to the manifest file, all we need to do is add the provider to the getAuthProviderList method, as follows:

private List<AuthUI.IdpConfig> getAuthProviderList() {
List<AuthUI.IdpConfig> providers = new ArrayList<>();
providers.add(
new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build());
providers.add(new
AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build());
providers.add(new
AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER).build());
providers.add(new
AuthUI.IdpConfig.Builder(AuthUI.TWITTER_PROVIDER).build())
;

return providers;
}

Now, we have successfully integrated Twitter with the application, with the support of FirebaseUI:

This screenshot explains Twitter integration using FirebaseUI. Let's now move on by exploring phone number sign-in using Firebase UI.