When we launched Twitter Kit as part of Fabric last fall, our goal was to help you keep your users engaged through rich, real-time content available only from Twitter. We released native Tweet embeds and Tweet timelines to help you do just that. Today, we’ve made another step towards that mission: users can now perform inline actions within Tweet embeds on both iOS and Android.
While your users can already consume unique, relevant content from Tweet embeds, many of them want to actually engage with those Tweets as part of your app experience. Now they will have immediate access to the two most popular inline actions: favoriting and sharing.
With just a few lines of code, you will have complete control over whether or not you display them within your app. By default these inline actions will be hidden to keep the process of embedding tweets simple.
On iOS, easily display the actions by setting the showActionButtons
property. Here’s an example of setting that property on a tweetView
:
let tweetView = TWTRTweetView(tweet: newlyLoadedTweet) tweetView.showActionButtons = true self.addSubview(tweetView)
On the Android side, construct a TweetView
or CompactTweetView
with a Tweet like usual and then simply enable the actions via tw__TweetLightWithActionsStyle
or tw__TweetDarkWithActionsStyle
. Here’s an example for CompactTweetView
:
final CompactTweetView tv = new CompactTweetView(context, tweet, R.style.tw__TweetLightWithActionsStyle); tv.setOnActionCallback(actionCallback);
One thing to note: your users would have to be logged-in to Twitter to perform these actions. If your users aren’t logged in, simply set a custom callback which can handle logged out user favorites by launching your login with the Twitter authentication flow. We will default to the callback action you’ve set up to make the experience seamless.
Check out our iOS and Android docs for a complete walkthrough on displaying actions and handling login.
With inline actions for Tweet embeds, you now have even more tools to control the experience your users have while engaging with Twitter content. If you don’t have Twitter Kit yet, get started by downloading Fabric at get.fabric.io!
Did someone say … cookies?
X and its partners use cookies to provide you with a better, safer and
faster service and to support our business. Some cookies are necessary to use
our services, improve our services, and make sure they work properly.
Show more about your choices.