Wise Android SDK (Kotlin)

1. Prerequisites

  • Project specifications:

    • Minimum API: 23

    • Compile API: 33

    • Recommended target API: 33

  • Send an email to info@wiseapp.live to get your VENDOR_ID and NAMESPACE to be used in the Android Integration steps below

2. Android SDK Integration

  1. Gradle version older than 7.x.x

    If you are on gradle version older than 7.x.x, add the below maven dependency to project level build.gradle file

    allprojects {
        repositories {
            google()
            mavenCentral()
            jcenter()
    
            **// START Wise SDK
            maven {
                url "<https://wise-maven.s3.ap-south-1.amazonaws.com/android/releases>"
            }
            // END Wise SDK**
        }
    }

    Gradle version greater than 7.x.x If you are using gradle plugin 7.x.x, add the maven depency to settings.gradle file located under project’s root directory

    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
            jcenter() // Warning: this repository is going to shut down soon
    
            **// START Wise SDK
            maven {
                url "<https://wise-maven.s3.ap-south-1.amazonaws.com/android/releases>"
            }
            // END Wise SDK**
        }
    }
  2. Download Zoom SDK and import them as modules in your project. After unzipping the downloaded file, you will find two folders mobilertc and commonlib inside.

    Download zoom-sdk-android-5.16.6.17198

  3. Import the Zoom SDK by navigating to File → New → Import Module and select the folder. You need to do this step for both mobilertc and commonlib folders.

  4. Open app/build.gradle and add Wise and Zoom SDK dependencies and sync the project.

dependencies {
    ....

    // wise sdk
    implementation "com.wise.sdk:core:1.1.8"
    
    // zoom sdk
    implementation project(path: ':mobilertc')
    implementation project(path: ':commonlib')
}

3. SDK Initialisation

In order to use the Wise SDK, it should be initialised first. This step can be done in your Application class or before starting / joining a meeting.

  • Set your Vendor ID and Namespace

  • Enable tracking meeting attentiveness

  • Set Lens icon

  • Enable / Disable screen capture

/**
Tracking attentiveness should be initialised in Application class
*/
class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()

        initLens()
    }

    private fun initLens() {
        // Enable tracking meeting attentiveness
        WiseSDK.getInstance(this).trackAttentiveness(this)
    }
}
/**
Initialising SDK should be done before starting / joining meeting
*/
private fun initSdk() {
    WiseSDK.getInstance(this).apply{
        // set vendor Id and namespace
        init(vendorId = "YOUR_VENDOR_ID", namespace = "YOUR_NAMESPACE")

        // enable / disable screen capture
        disableScreenCapture(true)

        //  custom lens icon
        setLensIcon(R.mipmap.ic_launcher)
		}
}

4. Joining a meeting

You can use joinMeeting() to join a meeting. The required {token} can be found in the {public link} of a classroom. To get the {public link} you should call /user/v2/classes/:classId API (documentation)

4.1 Join Meeting by Classroom ID

findViewById<Button>(R.id.btn_join_meeting).setOnClickListener {
            // goto meeting if it's in progress
            if (WiseSDK.getInstance(this).isMeetingInProgress()) {
                WiseSDK.getInstance(this).returnToMeeting()
            } else {
                // join meeting
                WiseSDK.getInstance(this)
		                .joinMeeting(
		                    classId = "classroom id", // ex: 64e4b66a2802b943425937d8
		                    disableScreenCapture = false,
		                    listener = this
		                )
            }
}

4.2 Join Meeting by Classroom Public ID

findViewById<Button>(R.id.btn_join_meeting).setOnClickListener {
            // goto meeting if it's in progress
            if (WiseSDK.getInstance(this).isMeetingInProgress()) {
                WiseSDK.getInstance(this).returnToMeeting()
            } else {
                // join meeting
                WiseSDK.getInstance(this)
                    .joinMeeting(
                        token = "classroom public id", // ex: 6304b66a2802b943425937d880910329
                        displayName = "User display name",
												userId = "user Id",
                        listener = this
                    )
            }
}

5. Login using SSO Token

To login into SDK using SSO Token, pass tho SSO token to loginUsingSSOToken() method.

WiseSDK.getInstance(this).loginUsingSSOToken("YOUR_SSO_TOKEN", object : WiseSDK.SSOTokenLoginListener{
    override fun onError(errorCode: Int, errorFlag: String?) {
        // Error occurred in SSO login
    }

    override fun onSuccess() {
        // sso login successful
    }
})

To logout from SSO, call logoutSSO() method.

WiseSDK.getInstance(this).logoutSSO() 

5. Meeting listeners

WiseSDKMeetingListener provides necessary callbacks to listen to meeting status.

interface WiseSDKMeetingListener {    
		// Called when vendor ID is verified
		fun onInitialised()

		// Throws an error when vendor ID is missing
    fun onVendorIdError()

    // When SDK throws and error. See below error codes for possible reason
    fun onSDKError(wiseErrorCode: Int, errorCode: Int, internalErrorCode: Int)

    // meeting initialisation started
    fun onMeetingConnecting()

    // Meeting started/joined successfully. This can be called multiple times
    fun onMeetingStarted(isInMeeting: Boolean)

    // Meeting ended successfully. This can be called multiple times. 
    // userId is the ID you pass while joining meeting
    fun onMeetingEnded(userId: String?)

    // Meeting ended by host
    fun onMeetingEndedByHost()

    // Meeting ended with an error
    fun onMeetingEndedWithError(message: String, errorCode: Int, internalErrorCode: Int)

    // Meeting requires a password or display name
    fun onMeetingNeedPasswordOrDisplayName()

    // Meeting not started by host
    fun onMeetingNotStartedByHostError()
}

6. Error Codes

In case of an error, onSDKError() will be triggered with an error code.

Error Code

Description

1

JWT Token error has occurred. This can be due to invalid vendor Id.

2

Zoom SDK failed to initialise.

3

Wise SDK failed to communicate with it’s servers.

4

Error fetching the SDK config

7. Proguard Rules

Add the below proguard rules to your proguard-rules.pro when minification is enabled.

# zoom sdk
-keep class  us.zoom.**{*;}
-keep class  com.zipow.**{*;}
-keep class  us.zipow.**{*;}
-keep class  org.webrtc.**{*;}
-keep class  us.google.protobuf.**{*;}
-keep class  com.google.crypto.tink.**{*;}
-keep class  androidx.security.crypto.**{*;}

# wise sdk
-keep class com.wise.sdk.data.** { *; }
-keep class com.wise.sdk.core.** { *; }
-keep class com.wise.sdk.network.result.** { *; }

Last updated