Skip to content

Real time Messaging

Mitchell Bryson edited this page Aug 5, 2026 · 14 revisions

Overview

This guide will show you how to configure an Android app to handle real-time messaging such as a chat client or group texting app. There are several approaches you can take to achieve this.

PubNub

One approach is to use the PubNub service to send and receive real-time messages. PubNub enables low-latency real-time apps that work across any number of platforms including Android, iOS, and JavaScript.

Setup

For Android, PubNub recommends its Kotlin SDK, distributed through Maven Central as a regular Gradle dependency (per the official SDK docs) — no manual JARs are involved:

dependencies {
  implementation 'com.pubnub:pubnub-kotlin:13.4.1'
}

Java codebases can use the separate Java SDK, which has shared a unified codebase with the Kotlin SDK since version 9.0.0.

Usage

PubNub works by allowing any number of clients to subscribe and send messages to any number of different channels. All clients subscribed to a channel will get messages sent to that channel in real-time.

PubNub

To subscribe and send messages to a channel, follow the configuration, publish, and subscribe walkthroughs in the Kotlin SDK documentation, which also covers Android-specific concerns such as ProGuard configuration and tearing the client down in onDestroy(). The SDK source and samples live in the pubnub/kotlin repository.

If you want messages to keep arriving while the app is backgrounded or closed, pair PubNub's channels with push notifications via Firebase Cloud Messaging rather than holding a long-lived socket open yourself — Android's background-execution limits make an always-on subscribe service unreliable on modern OS versions.

MirrorFly

MirrorFly is a real-time messaging solution with a chat API and SDK for web and mobile apps (Android, iOS) that helps integrate chat, audio, and video functionality into any platform.

Sinch

Sinch has consolidated its messaging products into the omnichannel Conversation API, which covers SMS, WhatsApp, RCS, and other channels; its in-app SDKs now focus on voice and video calling. The 2014-era Sinch Android instant-messaging tutorial this page previously linked is no longer maintained (its GitHub repository has been removed).

EnableX.io

EnableX offers developers a comprehensive channel of communications APIs (SMS, Messaging, Voice, Video and other collaborative tools) and all the necessary toolkits to develop innovative and engaging communication experience. Check out the SDKs and detailed guides for creating real-time messaging or try it out for free.

References

Finding these guides helpful?

We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.

Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.

Clone this wiki locally