Getting started

Let's intergrate our SDK in few minutes#
Download SDK Files

Introduction#

Requirements#

  • Android API Level 21 or above

Installation#

The SDK is already compiled into an AAR file. To use the SDK, the below AAR file has to be imported into the project. Call sdk needs kotlin support in your project.

STEPS:

  1. Create a new Android project or Open a existing project
  2. Add the following libraries in app/libs folder in the project
  • flycommons.aar
  • flynetwork.aar
  • flywebrtc.aar
  1. Add the following dependencies in app/build.gradle file.

    implementation files('libs/flycommons.aar')
    implementation files('libs/flynetwork.aar')
    implementation files('libs/flywebrtc.aar')
  2. Add the below dependencies required by the SDk in app/build.gradle

    //Socket - versions.gradle
    implementation 'com.github.nkzawa:socket.io-client:0.6.0'
    //Google - versions.gradle
    implementation 'org.webrtc:google-webrtc:1.0.32006'
    //okhttp interceptor
    implementation 'com.squareup.okhttp3:logging-interceptor:3.14.3'
    implementation 'androidx.core:core-ktx:+'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.31'
    //coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.3'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
    implementation 'androidx.media:media:1.0.0'
    //room database
    implementation 'androidx.room:room-runtime:2.2.5'
    kapt 'androidx.room:room-compiler:2.2.5'
    implementation "androidx.room:room-ktx:2.2.5"
    // Lifecycle
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    kapt 'androidx.lifecycle:lifecycle-compiler:2.2.0'
    //apicalls
    implementation 'com.squareup.retrofit2:retrofit:2.6.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
    implementation 'com.squareup.okhttp3:okhttp:4.2.0'
    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
  3. Add the below code in the app level build.gradle:

    plugins {
    ...
    id 'kotlin-android'
    id 'kotlin-kapt'
    }
    android {
    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
    jvmTarget = '1.8'
    }
    packagingOptions {
    exclude 'META-INF/AL2.0'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/LGPL2.1'
    exclude("META-INF/*.kotlin_module")
    }
    }
dependencies {
configurations {
all {
exclude group: 'org.json', module: 'json'
exclude group: 'xpp3', module: 'xpp3'
}
}
}
```

Initial setup#

In your application class oncreate method add the below lines:

ArgumentTypeDescription
SIGNAL_SERVER_DOMAINStringsignal server url
JANUS_WEBSOCKET_SERVER_DOMAINStringjanus websocket server url
CALL_UI_ACTIVITYClassActivity which needs to be invoked during incoming call. when a incoming call is received Call sdk will start this activity with the call details
ICE_SERVERS_LISTList<IceServer>Ice servers list( STUN,TURN)

Note: Pass your current user jid value to this method CallManager.setCurrentUserJid(). when you are making a call it will be used as caller jid.

@Override
public void onCreate() {
super.onCreate();
//initialize call sdk
CallManager.init(this);
CallManager.setCurrentUserId(SharedPreferenceManager.instance.getCurrentUserJid())
CallManager.setSignalServerUrl(SIGNAL_SERVER_DOMAIN);
CallManager.setJanusWebSocketServerUrl(JANUS_WEBSOCKET_SERVER_DOMAIN);
CallManager.setCallActivityClass(CALL_UI_ACTIVITY.class);
CallManager.setIceServers(ICE_SERVERS_LIST);
CallManager.setMissedCallListener((isOneToOneCall, userJid, groupId, callType, userList) -> {
//show missed call notification
});
CallManager.setCallHelper(new CallHelper() {
@NotNull
@Override
public String getDisplayName(@NotNull String jid) {
return ContactManager.getDisplayName(jid);
}
@Override
public boolean isDeletedUser(@NonNull String jid) {
return ContactManager.getProfileDetails(jid).getContactType() == ContactType.DELETED_CONTACT;
}
@Override
public void sendCallMessage(@NotNull GroupCallDetails details, @NotNull List<String> users, @NotNull List<String> invitedUsers) {
CallMessenger.sendCallMessage(details, users, invitedUsers);
}
});
ChatManager.setCallService(WebRtcCallService.class);

Setup your call activity#

Call UI Activity should be defined like below in your manifest

<activity
android:name="YOUR_CALL_ACTIVITY"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:excludeFromRecents="true"
android:launchMode="singleTask"
android:resizeableActivity="false"
android:screenOrientation="portrait"
android:supportsPictureInPicture="true"
android:showOnLockScreen="true"
android:turnScreenOn="true"
android:taskAffinity="call.video"
tools:targetApi="o_mr1" />

You need to call the below method on your call activityonCreate() to configure the call activity.

CallManager.configureCallActivity();

You need to call the below method on onStart() from your call activity to notify the call sdk to remove the ongoing call notification.

CallManager.bindCallService();

You need to call the below method on onStop() from your call activity to notify the call sdk to show the ongoing call notification.

CallManager.unbindCallService();
info

Call Sdk requires chat sdk integration for user management.