Twilio Client Android Quickstart

IMPORTANT
The Twilio Client SDKs for Android & iOS have been deprecated and replaced by Twilio's new Programmable Voice SDK. The Programmable Voice SDK offers many improvements over the Twilio Client SDK, including greater stability, improved backgrounding, and built-in support for push notifications for incoming calls.

Get started with the new Programmable Voice SDK by checking out one of the links below:
* Programmable Voice SDK for Android Quickstart
* Programmable Voice SDK for iOS: Objective-C Quickstart
* Programmable Voice SDK for iOS: Swift Quickstart

If you're just getting started with a Twilio mobile application for voice calling, we recommend you use the Programmable Voice SDK. If you're already using the Twilio Client SDK, you should plan to upgrade to the Programmable Voice SDK as soon as you're able.

In this tutorial, we will use the Twilio Client SDK for Android and TwiML to demonstrate making an outgoing call from a mobile app to a regular phone and receiving an incoming call from a phone in-app.

This guide assumes you have familiarity with Android and Java, and concepts like Activities (and their lifecycles) and Listeners. You should have some familiarity with building a basic Android application.

The tutorial is two-fold: first, we'll get you up and running with a functional Twilio Client for an Android demo application. Second, we'll walk through how the app works, explaining the core concepts and classes that you'll need to understand in order to customize the app. You will leave with enough information to deploy your own Twilio Client powered apps.

Prerequisites to Make Calls with the Android Client

  1. This tutorial assumes you are using Android Studio.
  2. You'll need your Twilio Account SID and Auth Token from the [Console (https://www.twilio.com/console/). If you don't have an account, you can sign up for a free trial account.
  3. A way to setup a web application server on the public Internet to host the server code for generating a capability token and TwiML (more on this later).

The Quickstart depends on a sample Python app deployed to Heroku for this purpose, but you can switch this out later to use any backend language and hosting infrastructure that you prefer. We can also recommend using ngrok to tunnel a port on a local dev server to the wider web.

Clone the Quickstart Mobile App Call Code and Server

The Twilio Client Android Quickstart exists in two parts: a sample Android app for the client side, and sample Python code for the server. First, download (orgit clone) each repository locally:

Next, let's get the server up and running first...

Next: Setting up your Server »

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.