Skip to contentSkip to navigationSkip to topbar
On this page

Voice Android SDK


Twilio Programmable Voice SDK for Android allows you to add voice-over-IP (VoIP) calling into your native Android applications.

(information)

Info

For step-by-step instructions to get up and running with the Android SDK for Programmable Voice, check out the Quickstart on Github(link takes you to an external page).

To make sure your app is ready for Android 11 please visit this page(link takes you to an external page).

(warning)

Warning

When using the Voice Android SDK with Twilio Regions, please make sure the SDK version is updated to at least 6.1.0


Authentication and Authorization

authentication-and-authorization page anchor

The Programmable Voice SDKs use a new authentication/authorization mechanism for your application server to give your clients access to your voice applications. Provide your app with an Access Token, which governs the client application's authentication session with your account in the Twilio cloud. Access Tokens are different from the Capability Tokens used in the previous versions of Twilio Client. Using a Capability Token in the Programmable Voice SDK will not work. Access Tokens, just like Capability Tokens, are JWT tokens(link takes you to an external page), but use a new, more flexible format that is applied across all new Twilio SDKs.


Developer tools and configuration options for Programmable Voice(link takes you to an external page) can be found in the Programmable Voice Dashboard(link takes you to an external page). Use the Console to create TwiML apps, update push credentials, view logs, and much more.


Supported devices and emulators

supported-devices-and-emulators page anchor

The Programmable Voice Android SDK supports armeabi-v7a, arm64-v8a, x86, and x86_64 architectures, as well as emulator images for these architectures.

The SDK supports Android API Level 21 (lollipop) and higher.

Voice Android SDK uses TLS 1.2 for secure communications.

To build the associated Quickstart project(link takes you to an external page) you will need Android Studio(link takes you to an external page) with installed SDK Platform for API Level 21, as well as the supporting libraries.


To install the latest Programmable Voice Android SDK add the following configuration to your build.gradle file:

1
allprojects {
2
repositories {
3
mavenCentral()
4
}
5
}
6
7
dependencies {
8
// The Voice SDK resides on Maven Central
9
implementation 'com.twilio:voice-android:5.7.2'
10
}

The SDK source and target compatibility is now set to Java 8. Starting with Voice Android SDK 5.4.1, the SDK is no longer binary compatible with applications that target Java 7. In order to use this and future releases, developers must upgrade their applications to target Java 8. Follow the snippet below for reference:

1
android {
2
compileOptions {
3
sourceCompatibility 1.8
4
targetCompatibility 1.8
5
}
6
}

Enable microphone permissions

enable-microphone-permissions page anchor

In order to target Android API level 21 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:

1
ActivityCompat.requestPermissions(this,
2
new String[]{Manifest.permission.RECORD_AUDIO}, MIC_PERMISSION_REQUEST_CODE);
3
}

See the Official Android Documentation(link takes you to an external page) for more details.

Starting with the Programmable Voice Android SDK 3.2.0 release, the SDK requires an updated set of ProGuard rules. The following snippets provide the correct ProGuard rules based on the release used by your application.

Voice Android 3.2.0+

voice-android-320 page anchor
1
# Twilio Programmable Voice
2
-keep class com.twilio.** { *; }
3
-keep class tvo.webrtc.** { *; }
4
-dontwarn tvo.webrtc.**
5
-keep class com.twilio.voice.** { *; }
6
-keepattributes InnerClasses

Voice Android 3.0.0-preview1 to 3.1.2

voice-android-300-preview1-to-312 page anchor
1
# Twilio Programmable Voice
2
-keep class com.twilio.** { *; }
3
-keep class org.webrtc.** { *; }
4
-dontwarn org.webrtc.**
5
-keep class com.twilio.voice.** { *; }
6
-keepattributes InnerClasses

These rules ensure that the Programmable Voice library is not removed by ProGuard.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.