Real-time Chat Blog

Easily Build an Android Chat App in One Afternoon

2 min read Michael Carroll on Sep 28, 2016
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

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 m...

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, user 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 PubNub 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.

More from PubNub

How to Add a Notification Badge to Icons in React Native
Real-time Chat BlogDec 19, 20226 min read

How to Add a Notification Badge to Icons in React Native

Display real-time notification badges with PubNub and React Native to display important information and bring users back to your...

Michael Carroll

Michael Carroll

Digital Twins and the Future of Real-Time Data
InsightsDec 6, 20224 min read

Digital Twins and the Future of Real-Time Data

The concept of Digital Twins has evolved over the last two decades, however, one thing remains the same: the need for real-time...

Michael Carroll

Michael Carroll

How Many Text Characters Fit in a 32KB PubNub Message?
Real-time Chat BlogNov 24, 20224 min read

How Many Text Characters Fit in a 32KB PubNub Message?

Learn the ins-and-outs of PubNub message size and get a better idea of how many text characters fit in a single message.

Michael Carroll

Michael Carroll