Integrating Popin SDK in Android
On this page
Introduction
Step 1: Add PopinAndroidSDK Dependency
Step 2: Initialize PopinAndroidSDK
Step 3: Create a Call Button
Step 4: Implement Call Button Functionality
Step 5: PopinConnectingDialog
Introduction
This guide explains how to integrate and use the PopinAndroidSDK to add video calling functionality to your Android application.
The SDK is easy to integrate and includes pre-built UI components such as PopinConnectingDialog, which handles call connection states and provides visual feedback to users while a call is being established.
Step 1: Add PopinAndroidSDK Dependency
To begin, add the PopinAndroidSDK dependency to your project.
Add JitPack Repository
Open your project’s settings.gradle file and add the JitPack repository:
Add SDK Dependency
In your app-level build.gradle file, add the following dependency:
Sync your project to make the SDK available.
Step 2: Initialize PopinAndroidSDK
Initialize the Popin SDK in your main activity. This is typically done inside the onCreate() method.
This prepares the SDK to manage video call sessions.
Step 3: Create a Call Button
Create a button in your layout XML file (for example, activity_main.xml) to allow users to start a video call.
Step 4: Implement Call Button Functionality
In your MainActivity.java, locate the button and attach an OnClickListener to initiate the video call.
Explanation of Call Events
onCallStart()
Triggered when the SDK begins connecting the call.
onQueuePositionChanged(int)
Provides queue updates if the call is placed in a waiting queue.
onAllExpertsBusy()
Called when no experts are available to accept the call.
onCallConnected()
Fired when the video call successfully connects.
onCallFailed()
Called when the call cannot be established.
onCallDisconnected()
Triggered when the call ends or is disconnected.
Step 5: PopinConnectingDialog
PopinConnectingDialog is a built-in dialog that appears while the video call is connecting. It typically displays a “Please wait” or “Connecting…” message to inform the user that the call is in progress.
Showing the Connecting Dialog
You can customize this dialog by modifying its layout or message to better match your application’s branding.
Last updated