4 minutes

How to Add Video Calling to Your App Easily (Quickblox SDK Overview)

One of the coolest things about mobile development is that you can always share results of your work with anyone of your friends or acquaintances.The feature we are going to discuss is surely one that can amaze your friends.

Let’s discuss how difficult it can be to integrate the video calls functionality into your app.

One of the possible solutions for performing video calls is based on the WebRTС technology. WebRTC is a media engine that offers real time communication natively from a web browser. Technology allows you to add into the app real time communication with audio, video and your own application data.

In the mobile world there are three possible modes for WebRTC today:

  • The hybrid application with webviews (starting from Android L)
  • The native browser
  • The native application

Today we will talk about the latter option. In order to create a native application for Android, WebRTC should be wrapped into SDK. One of such solutions for this is Quickblox Android SDK.

Quickblox SDK provides developers with a bunch of communication services such as chats, push notifications, file exchange, screen sharing and video calls.

To start working with Quickblox Android SDK you should:

  1. Create QuickBlox account
  2. Register an app on the Admin panel
  3. Add the dependency to your app build.gradle file
  4. Add quickblox dependency as local repository in project build.gradle file

The sdk uses native library:  libraries - libjingle_peerconnection_so.so
You need to copy native libraries from the sample and put them under - /src/main/jniLibs folder of your project.

In the sample project there is no libjingle  library for MIPS  platform, so for devices with this kind of processor architecture sample will not work.

The sample project contains multiple modules. We are interested in sample-videochat-webrtc.

When importing project take into account that you have to import the whole project instead of importing just video call sample. It’s because sample-videochat-webrtc module’s compileSdkVersion and minSdkVersion are defined as a project level variables.

Another issue that can appear when importing sample is error:
Error:Failed to crunch file [path to file]/ common_google_signin_btn_text_dark_pressed.9.png.

This error appears because path to the project is too long. To solve the problem just move the project for example to C://location.

The sample application is not trivial. It’s a simple but fully functional video and audio app. So it can take some time to extract video calling functionality from it.

The video calls sample has dependencies of core_sample_module,  so if you can’t find some pieces of code it’s probably hidden  in base classes of core_sample.

To use the sample you need just to enter chat room  and user name.  Install the app on the second device, enter the same room and you are ready to make calls.

You can also test video calls functionality with emulator.

To listen to the incoming calls the CallService is used. To start listening the following piece of code is used:

Every time the incoming call is  coming the onReceiveNewSession(QBRTCSession session) method of WebRtcSessionManager class is trigered.

All and all, with the help of an example, it’s possible to demonstrate how easy it is to implement (this) functionality into your app/extension. But if there’s a need to rely on SDK during a commercial project, you’ll most likely encounter a functionality that doesn’t work as you have expected. For example, sometimes when you’re on call activity, during a call, it’s impossible to exit out of the screen without hitting the backbutton. Also, “out of the box” is not an actualized transition between video and audio call. In order to make this happen, other solutions and workarounds must be mustered up ( for instance: always start with a video call and have the option to turn the video stream on and off).

It’s not that difficult to implement it, but problems may arise in regards to notifying about the switch (connection) of the person you’re talking to. In this case, we can utilize another class that is accessible within Quickblox SDK QBSystemMessagesManager. It will allow you to send messages accodringly. Also, you may encounter problems within SAMPLE when the mode “don’t keep activities” is turned on. For example, when the video call gets interrupted by a regular call. So if picky “QA” that love to test the programs in “don’t keep activities” mode,  control your work, then be prepared to spend a little extra time to fix these bugs/issues.


 Video calling is quite a complicated task that needs а lot of low level programming work. But as you see it’s possible to enhance your own app with this great feature using ready made solutions almost out of the box.

Hope you have found this article useful! Create great apps and share your experience with us in the comments section below. Keep in mind, we are always around to help you with you project.


Article Contents: