Real-time Chat Blog

Easily Build an Android Chat App in One Afternoon

2 min readPubNub Staff 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

Can Empathy Exist in the Metaverse
News May 16, 20221 min read

Can Empathy Exist in the Metaverse

A roundtable discussion led by PubNub’s COO, Casey Clegg, exploring the topics of what it means to be human in a virtual world.

PubNub Staff

PubNub Staff

How to Advance Telehealth and Virtual Care Technologies
News May 2, 20221 min read

How to Advance Telehealth and Virtual Care Technologies

Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...

PubNub Staff

PubNub Staff

Another Step Towards Data Security: ISO-27001 Implementation
BuildMay 2, 20221 min read

Another Step Towards Data Security: ISO-27001 Implementation

Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.

PubNub Staff

PubNub Staff