Build an Android chat app to communicate cross-platform

This tutorial will guide you through downloading, building and running the telehealth chat demo for Android.  You will then optionally make some basic changes to the app.  Don’t worry if you have little or no Android experience because this tutorial is aimed at all levels but if you are comfortable with Android Studio, you might want to clone the code and skim this step.

PubNub supports HIPAA, GDPR, SOC2 type 2, and CCPA compliance enabling you to build telemedicine applications.



You’ll need the following before you begin: 

  • Android Studio, any recent version. Android Studio is available for Windows, Mac, Linux and Chrome OS.

  • Git (optional).  The source code for this demo is hosted in GitHub and git is a popular tool to obtain the source but other options exist such as downloading it as a zip.

Obtaining the Source Code

The Telehealth demo app for Android is available from  This patient-doctor chat application uses PubNub’s Chat Components, which are pre-built UI and data building blocks to quickly create functional and visually appealing chat apps.

You can either:

Launch Android Studio and from the welcome screen and select ‘Get from Version Control’ which can be found under the three dots next to the ‘Open’ button.

Android Studio interface with open project list and a drop-down menu highlighting options such as Get from Version Control and SDK Manager.

Then when prompted to enter the repository URL, enter the following: and press ‘Clone’.

Android Studio software interface on a computer screen with an open dialog for cloning a repository from GitHub.

Or you can invoke the git tool from a terminal to clone the source code.  Navigate to an empty folder and enter the following command:


Or if you would rather download the source code as a zip file, click on the ‘Code’ button on GitHub and select ‘Download ZIP’.  You will need to unzip the file before you can load the source.

Github repository interface showing the "Download ZIP" button highlighted under the Code dropdown menu.

Other options exist, GitHub is very flexible :)

Open the code in Android Studio

If you do not already have the project loaded, launch Andriod Studio then select File → Open.

Select the directory where the source code is located and ‘Open’

IDE with open project showing README file for PubNub Chat Components on GitHub website.

Scroll to the bottom of the project files list and open  At the bottom of you will notice two entries for PubNub keys:



Computer screen with code and file directory open in Android Studio IDE showing a file.

You are not ready to run the application until you obtain those PubSub keys, so that is the next step.

BackStep 1 of 4Next