Java
Setting Up Authentication
In order to connect to a Vonage Video session, the client will need access to some authentication credentials — an App ID, Session ID, and Token.
In a production application, these credentials should be generated using a Server SDKs, but to speed things up we will hard code the values for now.
- Create a new Java class called
VonageVideoSDKConfigin the same folder as theMainActivity.javafile. - Start by copying the following code block and adding it to your
VonageVideoSDKConfigclass:public class VonageVideoSDKConfig { // Replace with a Application ID public static final String APP_ID = "YOUR_APP_ID"; // Replace with a generated Session ID public static final String SESSION_ID = "YOUR_SESSION_ID"; // Replace with a generated token (from the dashboard or using an OpenTok server SDK) public static final String TOKEN = "YOUR_TOKEN"; } - Go ahead and replace
YOUR_APP_IDwith the application ID we generated earlier. - Log into your your Vonage Dashboard and navigate to the Video Playground. It is under Troubleshoot & Learn - Developer Tools - Video - Playground.
- Make sure that the "Create a new session" tab is selected at the top.
- Select "Yes" under "Have a specific Application ID?"
- Paste in the Application ID you generated before into the "Application ID" box that appears.
- Leave everything else as-is, and click "Create Session".
- On the next page that appears, copy the "SESSION ID".
- In
VonageVideoSDKConfig.java, replaceYOUR_SESSION_IDwith the session ID we just copied. - Click the "Connect" button at the top.
- Expand the "Session and token info" section at the top.
- Copy the "TOKEN" that was generated
- In
VonageVideoSDKConfig.java, replaceYOUR_TOKENwith the token we just copied. - Save the
VonageVideoSDKConfig.javafile.
Important: You can continue to get the session ID and token values from your Account during testing and development, but before you go into production you must set up a server.
This information will allow our client-side code to talk to the Vonage Video API.
Basic text chat
Follow this tutorial to build basic text chat from scratch using the Vonage Video API. It is the quickest way to build a proof of concept for this functionality on the video platform.
Steps
1
Overview2
Before You Begin3
Configure a Vonage Video Application4
Creating the Project5
Setting Up Authentication6
Connecting to the Session7
Sending a Signal8
Receiving a Signal9
Testing your Code10
Conclusion