Kotlin

Requesting Permissions

Because our app uses audio and video from the user's device, we’ll need to add some code to request audio and video permissions. We'll use accompanist to make the process simple.

  1. Add permissions to AndroidManifest.xml

Inside your AndroidManifest.xml, add the following inside the <manifest> tag:

Note: The WAKE_LOCK permission is used to keep the device from sleeping during a video call. This ensures uninterrupted media streaming.

1a. Foreground Service for Media Projection

Screen capture must run inside a foreground service with type mediaProjection. Declare the service in your manifest:

  1. Add dependencies and manifest permissions

First, add the Accompanist dependency to your build.gradle file:

  1. Implement permission handling in compose

With Accompanist, we use rememberMultiplePermissionsState. This allows the UI to automatically react when permissions are granted or denied. Create a new file VideoChatPermissionWrapper.kt as follows:

  1. Update MainActivity.kt & define the initializeSession() method as a placeholder for your video call setup"

Now, integrate this into your MainActivity. Simply call your VideoChatPermissionWrapper inside setContent.

  1. Next Steps

Once permissions are granted, the initializeSession() function will be triggered. In the next steps of the tutorial, you'll implement the logic to connect to a Vonage Video API session.

Simple Multiparty

Learn how to use the Vonage Android SDK for a multi-party call. The application publishes audio/video from a device and can connect to multiple subscribers.

Available on:
Kotlin
Steps
1
Introduction
2
Getting Started
3
Creating a new project
4
Adding the Android SDK
5
Setting up authentication
6
Requesting permissions
7
Connect publish and show yourself
8
Multiparty subscribe to every remote stream
9
Host SDK views in AndroidView
10
Running the app
11
Conclusion