Integrating PopinAndroidSDK for Video Calls
This guide explains how to integrate and use the PopinAndroidSDK library to enable video calling features in your Android application. The SDK is lightweight, easy to integrate, and provides pre-built classes such as PopinConnectingDialog for managing connection states.
✅ Prerequisites
Android Studio installed
Minimum SDK version supported by PopinAndroidSDK
A valid Popin token
Step 1: Add PopinAndroidSDK to Your Project
1.1 Add JitPack to settings.gradle
settings.gradleOpen your project’s settings.gradle file and add the JitPack repository:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}1.2 Add SDK Dependency in build.gradle
build.gradleIn your app/build.gradle file, add the Popin SDK dependency:
1.3 Update AndroidManifest.xml
AndroidManifest.xmlInsert the following into your AndroidManifest.xml:
Replace <your_token_here> with your actual Popin token.
Step 2: Initialize Popin in Your App
Initialize Popin SDK in your main activity, typically inside the onCreate() method:
This prepares the SDK to handle video call connections.
Step 3: Add a Call Button in XML
Define a button in your layout file (activity_main.xml) to trigger the video call:
Step 4: Implement Button Click to Start Call
In your MainActivity.java, add the logic to initiate a call when the button is clicked:
Step 5: Understanding Call Events
Here’s a breakdown of the available PopinEventsListener callbacks:
onCallStart()
Called when the connection process begins.
onQueuePositionChanged(int i)
Invoked if the call is in a queue; use it to update the user interface.
onAllExpertsBusy()
Called when all experts are currently unavailable.
onCallConnected()
Triggered once the call is successfully connected.
onCallFailed()
Triggered if the call could not be connected.
onCallDisconnected()
Called when the call ends or is disconnected.
Step 6: Using PopinConnectingDialog
PopinConnectingDialogPopinConnectingDialog is a built-in dialog that shows a "Connecting..." message during the call initialization process.
To show the dialog:
You can customize the appearance by modifying its layout or message as needed.
🔚 Conclusion
You’ve now successfully integrated PopinAndroidSDK into your Android application for enabling video calls. This setup handles user initiation, UI feedback during connection, and real-time event handling via listener callbacks.
Last updated