Chat

Easily Build an Android Chat App in One Afternoon

Michael Carroll on Sep 28, 2016
Easily Build an Android Chat App in One Afternoon

Waving Hand

Good News! We've launched an all new Chat Resource Center.

We recommend checking out our new Chat Resource Center, which includes overviews, tutorials, and design patterns for building and deploying mobile and web chat.

Take me to the Chat Resource Center →

Building chat applications is easier today than ever before. Technologies supporting low-latency publish/subscribe messaging, user authentication, and other must-have chat features are readily available and easy to use.

For Android developers, the Twitter Fabric platform is one of the best tools for getting a scalable app up and running. PubNub provides the low-latency messaging to power the actual chat messages, presence monitoring, and chat history storage. Digits is a great option for user authentication.

We wrote two guides to get you well along the way to a fully featured chat app with only about an afternoon's worth of work.

Part 1: Get Started with Fabric and PubNub

PubNub adds real-time messaging to Twitter Fabric Android apps

In this tutorial, you'll:

  • Log in with Twitter auth.
  • Send chat messages to a PubNub channel (Chat): using the PubNub plugin for real-time messaging and Publish/Subscribe API.
  • Display current and historical chat messages (Chat): using the PubNub plugin and History API.
  • Display a list of what users are online (Presence): using the PubNub plugin and Presence API.

Part 2: Set up Digits User Authentication

With the chat basics in place, you'll need a method of user authentication to keep user data secure. Digits is an easy to use mobile identity provider that lets you authenticate user with their mobile phone, which increases engagement and makes email validation obsolete.

Build authentication for Android chat with Digits and PubNub

Although it isn't covered explicitly, you can combine the user authentication with Access Manager for fine-grain control over which users have access to which chat channels. You can grant, revoke, and expire tokens both programmatically and manually as needed. All of the 70+ PubNub SDKs come with full end-to-end encryption at no extra cost. So you are pretty much only a couple steps away from the next WhatsApp, selling it for billions of dollars, and buying a Tahitian island. Or something like that.

Oh, and if you're building a chat app, you definitely need to check out the PubNub BLOCKS catalog for chat applications. BLOCKS lets you program the network to handle application logic like chat translation with IBM Watson, spam filtering, and much more.