Test Environment. You are currently using the Webex for Developers test environment. Apps created here will not be available for use with Webex. Please visit Webex for Developers to manage your apps.

Android SDK

anchorVersions
anchor
  • Current version: 3.0.0
  • Previous version: 2.8.0
anchorFeatures
anchor
  • Audio and/or video 1:1 calling
  • Group space calling
  • Dial by email, Webex User ID, or SIP address
  • Call and event controls, including DTMF
  • Audio and video call control
  • View content and video simultaneously
  • Maximum bandwidth controls
  • Create Teams, Spaces, Memberships, and Messages
  • Receive and share content
  • Message securely with threads
  • Group call with three different views
  • Multistream capability for controlling individual video layout
  • Background Noise Reduction
  • Make and receive CUCM calls including hold/resume, transfer, merge
anchorRequirements
anchor
  • Android Studio 4.0 or later
  • Android SDK Tools 29 or later
  • Android API Level 24 or later
  • Java JDK 8
  • Kotlin - 1.3.+
  • Gradle for dependency management
  • Webex Account

NOTE : Required scopes are automatically added to the client, when any new integration is created using SDK version 3.0 and above. This guide explains how to create these integrations.

anchorRequirements for Calling in Webex (Unified CM)
anchor

To enable Calling in Webex (Unified CM), you must use one of the supported Unified CM-based Cisco call control solutions, and ensure that you're on the minimum supported version or later.

See Call Control Environment Requirements

anchorGetting Started
anchor

If you are working with Android, Webex allows you to integrate secure and convenient Webex messaging and calling features in your Android apps.

The Webex Android SDK gives you the ability to customize your app and to seamlessly access powerful Webex collaboration features without ever having to leave your mobile app. Use the Android SDK to apply your own UI for customization and still use client-side API calls to embed Webex voice and video calling directly into your application. With the Webex Android SDK, you can also connect end users from your app to any Webex app/device and SIP device.

In this guide, we'll show you how to create Webex spaces, post messages, and make and receive audio/video calls.

Step 1: Integrate the Webex Android SDK

First, you need to add the following repository to your top-level build.gradle file of your project module in Android Studio.

To do this, open the Project Structure view and then open your build.gradle (Project: Your Application Name) file. Then, add mavenCentral() underneath the allprojects -> repositories code blocks, as shown below:

allprojects {
    repositories {
        maven {
            url 'https://devhub.cisco.com/artifactory/webexsdk/'
        }
    }
}
Step 2: Add the Webex Android SDK Library

Now you need to include the Webex Android SDK library module as a dependency for your app.

To do this, add the following code and configuration to the dependencies block of the build.gradle (Module: app) file, as shown below:

dependencies {
   implementation 'com.ciscowebex:androidsdk:3.0.0@aar'
}
Step 3: Enable Multidex Support and Update Packaging Options

In order for your app code to compile correctly after integration, you will need to enable multidex support for your app.

To do this, add multiDexEnabled true to the build.gradle (Module: app) file, under defaultConfig, as shown below:

android {
    defaultConfig {
        multiDexEnabled true
    }
}

Enabling multidex support allows your app build process to generate more than one (DEX) file when you compile your app. See the Description in the Android documentation for more information.

You will also need to exclude the rxjava.properties file. To do this, add these packagingOptions to the build.gradle (Module: app) file, as shown below:

packagingOptions {
    exclude 'META-INF/rxjava.properties'
}

Configure the project to use ABI Filters and APK split, as shown below:

splits {
    abi {
        enable true
        reset()
        include 'armeabi-v7a'
        universalApk false
    }
}

Now, just sync the gradle dependencies to ensure that everything integrates properly.

Keep reading for details about how to use the Webex Android SDK with your application, starting with authenticating the user, and then moving on to creating spaces and sending messages.

Step 4: App Integration and Authentication

Before your app can use Webex on behalf of another user, you will need to register a Webex Integration. Your app will either need to authenticate users via an OAuth grant flow for existing Webex users, or via a Guest Issuer token for guest users that do not have a Webex account.

Once registration is complete, you will get a Client ID and Client Secret for use with the app. These can be used to generate a token with the proper scopes.

See the examples below for creating new Webex instances for existing Webex users or for guest users who do not have a Webex account.

Example #1 - Create a new Webex instance using Webex authentication (OAuth-based):
val clientId: String = "YOUR_CLIENT_ID"
val clientSecret: String = "YOUR_CLIENT_SECRET"
val redirectUri: String = "https://webexdemoapp.com"
val email = "EMAIL_ID_OF_END_USER" // Get email id from end user

val authenticator: OAuthWebViewAuthenticator = OAuthWebViewAuthenticator(clientId, clientSecret, redirectUri, email)
    val webex = Webex(application, authenticator)
    webex.initialize(CompletionHandler { result ->
        if (result.error != null) {
            //already authorised
        } else {
            authenticator.authorize(loginWebview, CompletionHandler { result ->
                    if (result.error != null) {
                        //Handle the error
                    }else{
                        //Authorization successful
                    }
                })
        }
    })
Example #2 - Create a new Webex instance using Guest Issuer authentication (JWT-based):
val token: String = "jwt_token"
val authenticator: JWTAuthenticator = JWTAuthenticator()
val webex = Webex(application, authenticator)
webex.initialize(CompletionHandler { result ->
        if (result.error != null) {
            //already authorised
        } else {
            authenticator.authorize(token, CompletionHandler { result ->
                    if (result.error != null) {
                        //Handle the error
                    }else{
                        //Authorization successful
                    }
                })
        }
    })
Using Webex with your App

Now that you're authenticated, you can use Webex. You can create a space, add users, and post messages using the SDK.

Create a space:

webex.spaces.create("Hello World", null, CompletionHandler<Space?> { result ->
        if (result.isSuccessful) {
            val space = result.data
        } else {
            val error= result.error
        }
    })

Add users to the space:

webex.memberships.create("spaceId", null, "person@example.com", true, CompletionHandler<Membership?> { result ->
        if (result.isSuccessful) {
            val space = result.data
        } else {
            val error= result.error
        }
    })

Post messages to the space:

webex.messages.postToSpace("spaceId", Message.Text.plain("Hello"), null, null, CompletionHandler<Message> { result ->
        if(result != null && result.isSuccessful){
            val message = result.data
        }
    })
Webex Audio/Video Calling

This is the most significant SDK feature which enables users to make and receive audio/video calls via Webex. Calling in the SDK is very easy to use.

webex.phone.dial("person@example.com", MediaOption.audioVideo(local, remote), CompletionHandler {
        val call = it.data
        call?.setObserver(object : CallObserver {
            override fun onConnected(call: Call?) {
                super.onConnected(call)
            }

            override fun onDisconnected(event: CallDisconnectedEvent?) {
                super.onDisconnected(event)
            }

            override fun onFailed(call: Call?) {
                super.onFailed(call)
            }
        })
    })

These calls can be made to Webex users/devices, Telepresence systems, SIP devices, and regular telephones. If the user calls a telephone system such as an IVR, the SDK also supports DTMF transport so users can navigate IVR menus.

To send DTMF, simply invoke call.send(dtmf, completionHandler):

// Send DTMF
Call.sendDTMF(dtmfEvent, CompletionHandler { result ->
        if (result.isSuccessful) {
            // sendDTMF successful
        } else {
            // sendDTMF failed
        }
    });

To receive a call:

webex.phone.setIncomingCallListener(object : Phone.IncomingCallListener {
        override fun onIncomingCall(call: Call?) {
            call?.answer(MediaOption.audioOnly(), CompletionHandler { 
                if (it.isSuccessful){
                    // ...
                }
            })
        }
    })
anchorComplete Demo App
anchor

A complete demo application is available to see the complete functionality of the SDK.

anchorSDK API Reference
anchor

In-depth API reference information for the Android SDK can be found here

anchorTroubleshooting the Android SDK
anchor

If you're having trouble with the Android SDK, here's some more information to help troubleshoot the issue.

SDK Requirements

Review the following SDK requirements to make sure you're using the correct minimum versions of Android Studio, Java JDK, etc.:

  • Android Studio 4 or later
  • Android SDK Tools 29 or later
  • Android API Level 24 or later
  • Java JDK 8
  • Kotlin - 1.3.+
  • Gradle for dependency management
View the System Logs

The Webex Android SDK uses the Android system logger utility to collect log messages that will allow you to define problem areas when troubleshooting.

Use the Logcat command-line tool to collect, view, and filter all SDK logs. The Android SDK provides the option to display all messages or just the messages that indicate the most severe errors. Set the log level to verbose to display all errors. See Write and View Logs with Logcat for more information.

webex.setLogLevel(Webex.LogLevel.VERBOSE)
Firewall Ports

The Android SDK makes use of the following network ports. If you're encountering connection issues, make sure there aren't any firewalls blocking or preventing communication over these ports.

ServiceProtocolPort(s)
MessagingHTTPS443
NotificationsWebSocket443
CallsHTTPS443
MediaRTP/SRTP over UDP/TCP33434-33598, 8000-8100 or 33434 (shared port)
SDK Dependencies

For more information about dependencies of the Android SDK, please refer to their documentation:

App Crashes

If your app is crashing, running a stack trace may help you determine the root cause. Please see Android’s Diagnose the Crashes for more information about determining the cause of Android app crashes.

Support Policy

Please visit the Webex API and SDK Support Policy page for details on our support and end of life policy for APIs and SDKs.

Getting Support

If you're stumped, contact the Webex Developer Support team for more help with the SDK.

anchorH.264 License Information
anchor

The Webex Android SDK uses H.264 AVC video, which requires activation of a license agreement by each user. The end-user is prompted to activate H.264 codec license with a AlertDialog. The license activation alert will appear automatically during the first video call. From the AlertDialog, the license can be activated, viewed, or the user can choose to cancel the activation. No local or remote video will be rendered until the user chooses to activate the video license.

Once user activates the video license, they will not be prompted to do so again for subsequent calls. If the app is uninstalled and reinstalled, the video license will need to be re-activated. Additionally, you may choose to invoke license activation alert anytime prior to the first video call using the requestVideoCodecActivation() function.

The disableVideoCodecActivation() function prevents the SDK from prompting for H.264 video codec license activation. Use this if your company has its own license agreement for H.264 AVC video from MPEG LA, and you wish to disable the display of the video license AlertDialog. If you disable the built-in activation capability of the Webex SDK for Android, you do so at your own risk and are responsible for any royalties or other fees associated with your use of the H.264 AVC video codec.