Testing your Code
At this point, your MainActivity.java file should look something like this (with a few adjustments):
In your completed code, you should have hard coded values to replace YOUR_APP_ID, YOUR_SESSION_ID and YOUR_TOKEN in the VonageVideoSDKConfig class — if you haven't done this, see Setting up authentication above.
- Build and run the app in Android Studio.
- Enter some text into the text field and send it.
- You should see the message get added to the message history.
Next, we can test what it looks like if someone else sends a message. We can simulate that by running the app again on a different emulator/device:
- Build and run the app on a different emulator.
- Enter some text into the textfield and send it on both emulators.
- You should see a both messages get added to the message history.
Troubleshooting tips: If you cant connect to the session, check the Android Studio Logcat window for errors. The most likely issue is that your API key, session ID, or token is not set up properly. Since you hard coded your credentials, it's also possible that your token has expired. If you get a build error related to the compile version, you can change it in the app level build.grade file.
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.