Rate this page:

Migrating from 1.x to 2.x - Android

This guide provides an introduction to the 2.x Programmable Video Android SDK and a set of guidelines to migrate an application from 1.x to 2.x.


The Video SDK defines a set of objects that represent a multi-party exchange of media. These objects fall into two types of models: Room model and Media model.

Room Model Migration

In Programmable Video 1.x the Room model was comprised of a Room, a LocalParticipant, and one or more Participant(s). Starting with Programmable Video 2.x, the Room model is now comprised of a Room, a LocalParticipant, and one or more RemoteParticipant(s). The LocalParticipant and RemoteParticipant(s) implement a Participant interface.

Track Publications

In Programmable Video 1.x LocalParticipant and Participant were comprised of Track(s). Programmable Video 2.x introduces the TrackPublication interface implemented by the following objects:

  • LocalAudioTrackPublication
  • LocalVideoTrackPublication
  • LocalDataTrackPublication
  • RemoteAudioTrackPublication
  • RemoteVideoTrackPublication
  • RemoteDataTrackPublication

TrackPublication(s) represent the tracks available in a Room comprised of media from LocalParticipant and RemoteParticipant(s). LocalTrackPublication(s) are available via LocalParticipant and RemoteTrackPublication(s) are available via RemoteParticipant. The following graph visualizes the Room model updates from 1.x to 2.x.

Room Model Migration

Media Model Migration

In Programmable Video 1.x the Media model was comprised of a Track interface implemented by an AudioTrack and VideoTrack. LocalAudioTrack and LocalVideoTrack extended AudioTrack and VideoTrack respsectively. Programmable Video 2.x Media model maintains the same relationship between Track and AudioTrack/VideoTrack and introduces a new implementation of Track: DataTrack (For more on DataTracks, see guide). AudioTrack, VideoTrack, and DataTrack are extended by the following objects:

  • LocalAudioTrack
  • LocalVideoTrack
  • LocalDataTrack
  • RemoteAudioTrack
  • RemoteVideoTrack
  • RemoteDataTrack

The following graph visualizes the Media model updates from 1.x to 2.x.

Media Model Migration

Complete Picture

The following diagrams define all objects and their relationships in the 1.x and 2.x Video SDK.

Video Android 1.x Object Graph

Video Android 2.x Object Graph

Updating an Application

This section provides a set of guidelines to migrate an application from Programmable Video Android SDK 1.x to 2.x.

Reference the 2.0 quickstart when migrating an application from Programmable Video Android 1.x to 2.x


Participant events moved from Participant.Listener to RemoteParticipant.Listener. To receive RemoteParticipant events invoke setListener with an implementation of RemoteParticipant.Listener. Reference the API docs for more information on RemoteParticipant.Listener.

Managing Remote Media

In Programmable Video 1.x, applications manage media shared by participants when tracks are added or removed. Starting with Programmable Video 2.x, applications should manage media when tracks are subscribed or unsubscribed. Rendering video when a participant shares a video track provides an example of logic that will need to be updated when migrating to 2.x. In 1.x an application receives onVideoTrackAdded or onVideoTrackRemoved event to render or remove the video track from the UI. In 2.x applications should use onVideoTrackSubscribed and onVideoTrackUnsubscribed to perform video rendering logic.

LocalParticipant Updates

Applications using LocalParticipant to share tracks need to perform the following updates:

  • Change all uses of addVideoTrack or addAudioTrack to publishTrack
  • Change all uses of removeVideoTrack or removeAudioTrack to unpublishTrack

Participant Updates

Participant remains a public interface, but applications should perform the following updates when migrating to Programmable Video Android 2.x:

  • Update all references of Participant to RemoteParticipant
  • Change room.getParticipants to room.getRemoteParticipants
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 by visiting Twilio's Community Forums or 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. Please select the reason(s) for your feedback or provide additional information about how we can improve:

        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