Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Twilio Client Android SDK

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.


Want your Android app to make and receive calls? Look no further!

Twilio Client Android is a Java library for Android that enables voice communications with landlines or other Twilio Client devices, including web browsers and other mobile devices.

Install the Android SDK

To install the latest Client SDK library add the following configuration to your build.gradle file:

allprojects {
  repositories {

dependencies {
  // The Client SDK resides on jCenter
  compile 'com.twilio:client-android:1.2.21'

Enable Microphone Permissions

In order to target Android API level 23 or later, you will need to ensure that your application requests runtime permissions for microphone access. To do this, perform the following two steps:

First, add the following to your Android Manifest file:

 <uses-permission android:name="android.permission.RECORD_AUDIO"/>

Second, request microphone permissions from within your application code:

    new String[]{Manifest.permission.RECORD_AUDIO}, MIC_PERMISSION_REQUEST_CODE);

See the Official Android Documentation for more details.

Client Service

The Client SDK utilizes an Android Service to maintain availability while your application is not in the foreground, the service must be declared in your AndroidManifest.xml

<service android:name="com.twilio.client.TwilioClientService" 
                       android:exported="false" android:stopWithTask="true"/>

ProGuard Exception

Add the following line to your proguard-project.txt file.

# Twilio Client
-keep class com.twilio.** { *; }

# Apache HttpClient
-dontwarn org.apache.http.**

This ensures that the Twilio Client library is not removed by ProGuard.


There are three major pieces in a Twilio Client app:

  1. Your Android app that uses the Twilio Client Android library
  2. A server to grant capabilities to your Client app as well as to serve up TwiML and/or make Twilio REST API calls
  3. Twilio's cloud services to handle the telephony and process TwiML and/or REST API calls

Twilio Client Android SDK Architecture

Client-side Classes

The primary class for connecting to Twilio services from your app is Device. This class coordinates service authorization with Twilio, listens for incoming connections, and establishes outgoing connections. An instance of this class is created using a "capabilty token", described in the next section.

Connections to Twilio, either incoming or outgoing, are represented by instances of the class Connection.

In addition, status callbacks are provided to objects that implement the listener interfaces DeviceListener and ConnectionListener.

Server-side Security: Capability Tokens

The Twilio Client SDK uses a capability token to sign communications from your Android app to Twilio. These tokens are created by you on your server and allow you to specify what capabilities are going to be available to your app, such as whether it can receive incoming connections, make outgoing connections, etc. These tokens always have an expiration, which means all tokens have a limited lifetime to protect you from abuse. It is up to you to determine how often these tokens must be refreshed.

Twilio capability tokens are based on the JSON Web Token standard. They can be generated with our helper libraries that come in a variety of languages.

For the security of your Twilio account, you should not embed a Capability Token or your Twilio Auth Token as strings in the app you submit to the Google Play Store.

Rate this page:

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.