Suggestions

close search

Back to Basic Video Chat Overview

Basic Video Chat Step 1: Getting set up

  1. 1
    Basic Video Chat Step 1:
    Setting up the test web service
  2. 2
    Basic Video Chat Step 2:
    Configuring and testing the app
  3. 3
    Basic Video Chat Step 3:
    Initializing an OpenTok session
  4. 4
    Basic Video Chat Step 4:
    Connecting to the session
  5. 5
    Basic Video Chat Step 5:
    Publishing a stream to the session
  6. 6
    Basic Video Chat Step 6:
    Subscribing to audio-video streams

This tutorial will help you create a basic video chat application for Android. You can follow along with a completed version of the application by cloning the https://github.com/opentok/learning-opentok-android repository:

git clone git@github.com:opentok/learning-opentok-android.git
cd learning-opentok-android

and checking out the basics branch

git checkout basics

Make sure you update Android Studio and the Gradle plugin before you continue. Android Studio should notify you if these are not up to date.

Complete the following steps to set up your app:

  1. In Android Studio, select the File > Import Project command. Navigate to the root directory of this project, select the build.gradle file, and then click the OK button. The project opens in a new window.

    The Java code for the application is in the ChatActivity class in the com.tokbox.android.demo.learningopentok package.

  2. This project uses Gradle to load the OpenTok Android SDK. Gradle downloads the SDK from the OpenTok Maven repository at http://tokbox.bintray.com/maven.

    Make sure that you are pointing to this URL. In your Project level's build.gradle, you should see the following code snippet in the allprojects/repositiories section:

     maven { url  "http://tokbox.bintray.com/maven" }
    

    Additionally, the app Module level's build.gradle should specify the version of the SDK that you want to use. For the latest stable version, you should find the following code snippet in the dependencies section:

     compile 'com.opentok.android:opentok-android-sdk:2.10.1-REL-2782'
    

Next up, you will set up and deploy a service to provide your Android client sessions and Tokens.

  1. 1
    Basic Video Chat Step 1:
    Setting up the test web service
  2. 2
    Basic Video Chat Step 2:
    Configuring and testing the app
  3. 3
    Basic Video Chat Step 3:
    Initializing an OpenTok session
  4. 4
    Basic Video Chat Step 4:
    Connecting to the session
  5. 5
    Basic Video Chat Step 5:
    Publishing a stream to the session
  6. 6
    Basic Video Chat Step 6:
    Subscribing to audio-video streams