/qiscus-rtc-sdk-android

QiscusRTC SDK for Android

Primary LanguageJava

Qiscus RTC SDK Android

Release



Qiscus RTC SDK is a product that makes adding voice calling to mobile apps easy. It handles all the complexity of signaling and audio management while providing you the freedom to create a stunning user interface. On this example we use our simple websocket push notification for handle call notification. We highly recommend that you implement a better push notification for increasing call realiability, for example GCM, FCM, MQTT, or other standard messaging protocol.

Quick Start

Below is a step-by-step guide on setting up the Qiscus RTC SDK for the first time

Dependency

Add to your project build.gradle

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}
dependencies {
  compile 'com.github.qiscus:qiscus-rtc-sdk-android:0.7'
}

Permission

Add to your project AndroidManifest.xml

<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
    
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Authentication

Init Qiscus

Init Qiscus at your application

Parameters:

  • context: context
  • app_id: String
  • app_secret: String
public class SampleApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        QiscusRTC.init(this, app_id, app_secret);
    }
}

To get your app_id and app_secret, please contact us.

Init with custom host

Qiscus also provides on-premise package, so you can host signaling server on your own network. Please contact us to get further information.

Parameters:

  • context: context
  • app_id: String
  • app_secret: String
  • host: String
public class SampleApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        QiscusRTC.init(this, app_id, app_secret, host);
    }
}

Method

Register User

Before user can start call each other, they must register the user to our server

Parameters:

  • username: String
  • displayName: String
  • avatarUrl: String
QiscusRTC.register(username, displayName, avatarUrl);

Start call object:

  • roomId: String
  • callAs: Enum QiscusRTC.CallAs.CALLER / QiscusRTC.CallAs.CALLEE
  • callType: Enum QiscusRTC.CallType.VOICE / QiscusRTC.CallType.VIDEO
  • callerUsername: String
  • calleeUsername: String
  • callerDisplayName: String
  • calleeAvatarUrl: String

Start Call

Start voice call

QiscusRTC.CallActivityBuilder.buildCallWith(roomId)
                            .setCallAs(QiscusRTC.CallAs.CALLER)
                            .setCallType(QiscusRTC.CallType.VOICE)
                            .setCallerUsername(QiscusRTC.getUser())
                            .setCalleeUsername(calleeUsername)
                            .setCalleeDisplayName(calleeDisplayName)
                            .setCalleeDisplayAvatar(calleeAvatarUrl)
                            .show(this);

Start video call

QiscusRTC.CallActivityBuilder.buildCallWith(roomId)
                            .setCallAs(QiscusRTC.CallAs.CALLER)
                            .setCallType(QiscusRTC.CallType.VIDEO)
                            .setCallerUsername(QiscusRTC.getUser())
                            .setCalleeUsername(calleeUsername)
                            .setCalleeDisplayName(calleeDisplayName)
                            .setCalleeDisplayAvatar(calleeAvatarUrl)
                            .show(this);

Custom your call

You can custom your call notification, icon and callback button action with QiscusRTC.Call.getCallConfig()

QiscusRTC.Call.getCallConfig()
                .setBackgroundDrawble(R.drawable.bg_call)
                .setOngoingNotificationEnable(true)
                .setLargeOngoingNotifIcon(R.drawable.ic_call_white_24dp);

That's it! You just need 3 steps to build voice call in your apps.

Example