Menu

Expand
Rate this page:

Android SDK

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

For step-by-step instructions to get up and running with the Android SDK for Programmable Voice, check out the quickstart on Github.

To make sure your app is ready for Android 11 please visit this page.

Authentication/Authorization

In the Programmable Voice SDKs we use a new authentication/authorization mechanism for your application server to give your clients access to your voice applications. This is done by providing your app 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 before, are JWT tokens, but are using a new, more flexible format that is used across all the new Twilio SDKs.

Management Console

Developer tools and configuration options for Programmable Voice can be found in the Programmable Voice Dashboard. Use the console to create TwiML apps, update push credentials, view logs, and much more.

System Requirements

Supported Devices and Emulators

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

Supported API Levels

The SDK supports Android API Level 16 (Jelly Bean) and higher.

Developer Tools

To build the associated Quickstart project you will need the following tools:

  • Android Studio with installed SDK Platform for API Level 24, as well as the supporting libraries.

Installing the SDK

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

allprojects {
  repositories {
     jcenter()
  }
}

dependencies {
  // The Voice SDK resides on jCenter
  implementation 'com.twilio:voice-android:3.1.2'
}

Java Compatibility

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:

android {
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

Enabling 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:

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

See the Official Android Documentation for more details.

Setting up ProGuard Rules

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+

# Twilio Programmable Voice
-keep class com.twilio.** { *; }
-keep class tvo.webrtc.** { *; }
-dontwarn tvo.webrtc.**
-keep class com.twilio.voice.** { *; }
-keepattributes InnerClasses

Voice Android 3.0.0-preview1 to 3.1.2

# Twilio Programmable Voice
-keep class com.twilio.** { *; }
-keep class org.webrtc.** { *; }
-dontwarn org.webrtc.**
-keep class com.twilio.voice.** { *; }
-keepattributes InnerClasses

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

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.

        
        
        

        Thank you for your feedback!

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

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more