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 Class Reference

Deprecation Notice

The Twilio Client SDK for Android has been deprecated and replaced by Twilio's 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.

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.

Get started with the new Programmable Voice SDK by checking out the quickstart for Programmable Voice SDK for Android on Github.


  • Package: com.twilio.client
  • Subclass of: Object

Abstract class used to initialize and shut down the Twilio Client SDK.

Nested Classes


Name Description Type
initialize Initialize the Twilio Client SDK. Static method
shutdown Shuts down the Twilio Client SDK. Static method
isInitialized Determines if the Twilio Client SDK has been initialized or not. Static method
createDevice Create and initialize a new Device object. Static method
listDevices Retrieves a list of all active Devices. Static method


void initialize(Context inContext, InitListener inListener)

Initialize the Twilio Client SDK.

The SDK needs to start an Android Service to handle voice. When this service has been started, a Device can be created and used.

Name Description
inContext The Application Context from your Android app. Make sure you don't pass an Activity Context. You can retrieve the Application Context by calling getApplicationContext() on your Activity. Cannot be null.
inListener A InitListener that will notify you when the service is ready. Cannot be null.
Return Value


void shutdown()

Shuts down the Twilio Client SDK.

This will terminate all connections, release all Device objects, and release any resources used by the SDK.

Note that any attempt to access existing Device or Connection objects after calling this method may cause an exception to be thrown, or a crash.

Return Value


boolean isInitialized()

Determines if the Twilio Client SDK has been initialized or not.

If you expect your application to run in the background when the user has switched to other applications, you will want to check the return value of this method on startup. The Android OS may have killed your application due to memory pressure, but the SDK may still be running in the background.

Return Value

true if the SDK is currently initialized, false otherwise

Device createDevice(String inCapabilityToken, DeviceListener inListener)

Create and initialize a new Device object.

If the incoming capabilities are defined, then the device will automatically begin listening for incoming connections.

Name Description
inCapabilityToken A signed JSON Web Token that defines the features available to the Device. These may be created using the Twilio Helper Libraries included with the SDK or available at The capabilities are used to begin listening for incoming connections and provide the default parameters used for establishing outgoing connections. Please visit for more information.
inListener The optional listener object which will receive events from a Device object.
Return Value

The initialized Device object, or null if the SDK was not initialized

List<> listDevices()

Retrieves a list of all active Devices.

Return Value

An unmodifiable List of Device objects

public static void setLogLevel(int level)

Sets the logging level for messages logged by the Twilio SDK.

Log levels correspond to those specified by Android's Log class.

To disable all Twilio SDK logging, set this to Log.ASSERT. The default is Log.ERROR.

public static void setMetrics(boolean enable)

Toggle the call quality analytics publishing feature of the Twilio SDK. This is enabled by default.

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.

Loading Code Sample...