Home > Articles > How We Use Google Firebase in Our Game: Customized Twitter Collections

How We Use Google Firebase in Our Game: Customized Twitter Collections

We’re getting ready to launch our first game, Plasma, to our group of alpha testers, and I wanted to share with you one of the ways we use Google Firebase Remote Config (love), Google Analytics, Google Play, Google In App Billing, and Twitter collections. It may sound complex, but really, it’s all simple and quite powerful.

Like other apps, we have an “About” menu with items like acknowledgements and contact info. But unlike many, we have included Tweets. Specifically, a collection of Tweets. And even more specifically, a collection of Tweets, customized for groups of players.

Here’s how we do it:

1) Using TweetDeck, we create collections for different groups. For instance, we have a collection of tweets for players who have upgraded to advanced levels using Google InApp Purchasing and are Google Play players.

puzzle games twitter

Collection of tweets for Google Play players and those that have upgraded.

2) Then, in the Google Firebase Remote Config console, we use Google Analytics user properties to set a condition. Earlier, we had set up Google Analytics to collect a player’s upgrade status and Google Play status in our code and in the Analytics console.

We then use these user properties in the Remote Config condition creator to create a condition to display our parameter. Remote Config has a robust condition creator so we can dig deep into user properties and apply a boatload of operators. After that, we set a parameter with the collection ID from Tweetdeck. We can define multiple groups and assign collection ids accordingly.

 

 

3) And of course, our code is set up to use the collection parameter:

collectionID = mFirebaseRemoteConfig.getString("collection");

timeline = new CollectionTimeline.Builder()
        .id(Long.parseLong(collectionID))
        .maxItemsPerRequest(10)
        .build();

There’s a bit more to this, codewise, but you get the general idea. Twitter developer docs has loads of examples for this bit.

 

And that’s it! Well, sortof. We also use some Google Firebase Remote Config magic to notify the bottom bar that there’s new tweet content (we display a badge) and customize the menu option:

addicting twitter

We use Google Firebase Remote Config to customize the menu item when there are new Tweets.

And as we add on support for different languages, we can localize this message using Remote Config as well.

Any questions? Feel free to drop them in the comments and I will do my best to help!

About Friday

Developer, gardener, animal lover. Wife of a puzzlemonster. My coding resume shows my age: Wordperfect reveal codes => HTML => ASP Classic => SQL => JavaScript => jQuery => PHP => Wordpress under-the-hood => Java => Android dev.

One comment

Leave a Reply