SightCall Developer Center

Account Login Support

Android SDK

This section is dedicated to the integration of the Android SDK client into a native app.

System requirements

The SightCall Android SDK requires a minimum API level of 14 (Android 4.0+).
The SightCall Android SDK is compatible with ARM-based devices having at least one camera.

Download and link the Android SDK

Download

The Rtcc SDK is available on a GitHub repository located at https://github.com/sightcall/Android-SDK

Android Studio

Since Google introduced Android Studio as the official IDE for Android in November 2014, Eclipse and its plugin ADT are no longer supported for this SDK.
Reference ~ Help to migrate

Create a new Project

Create a new Android project from the Android Studio Wizard or open an Android project.

Include Rtcc SDK

Add the rtcc-*.jar file in the libs directory, and reference it in the build.gradle file:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

Add the armeabi-v7a folder in the jniLibs directory.
This folder can be created with Android Studio: New…FolderJNI Folder

Don't forget to sync the project. Click on the Sync Project with Gradle Files icon.

Declare permissions

In order to run, the Rtcc SDK requires some permissions to be declared by the application.

If a required permission is missing, the SDK will terminate the application and log the missing permissions in the logcat.

In the application's AndroidManifest.xml file, add the following permissions:

<manifest>
    <!-- Internet access -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Video capture -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <!-- Audio capture -->
    <uses-permission android:name="android.permission.CAMERA" />
    <!-- Change audio route -->
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
</manifest>

Initialize the Rtcc SDK

Most of RTCC SDK features are accessible through the RtccEngine singleton via Rtcc.instance().

In order to initialize this singleton, call the asynchronous method Rtcc.initialize(String, Context).

A ConnectedEvent will be fired to corresponding listeners, reflecting the success or failure of the initialization process.

If, and only if this process succeeds, the singleton will be created automatically.

public void initialize(String appid, Context context) {
    Rtcc.initialize(appid, context);
}

@RtccEventListener
public void onConnected(ConnectedEvent event) {
    if (event.isSuccess()) {
        // The app is connected, you can start authentication
    } else {
        // An error occured during initilization
    }
}

EventBus

The EventBus is responsible for dispatching events generated by the Rtcc SDK to your application.

To be notified of such events, listeners must be registered.

Good practices are:

public class MainActivity extends Activity {

    @Override
    public void onResume() {
        super.onResume();
        Rtcc.eventBus().register(this);
    }

    @Override
    public void onPause() {
        super.onPause();
        Rtcc.eventBus().unregister(this);
    }

}

UI Considerations

One-to-One Calls

Displaying a call requires you to provide a VideoOutPreviewFrame to render the local video as well as a VideoInFrame to render the remote one.

The remote view must be set using the DEFAULT_CONTACT_ID value (corresponding to the default remote id in a 1:1 call).

VideoOutPreviewFrame videoOutFrame = (VideoOutPreviewFrame) findViewById(R.id.video_out);
Rtcc.instance().getCurrentCall().setVideoOut(videoOutFrame);

VideoInFrame videoInFrame = (VideoInFrame) findViewById(R.id.video_in);
Rtcc.instance().getCurrentCall().setVideoIn(videoInFrame, Contact.DEFAULT_CONTACT_ID);

Multiparty Calls

In a multi-party call, you will have to handle a master video and multiple video thumbnails.

Each time you receive an event of type ParticipantEvent, ParticipantListEvent, or FloorListEvent, you should update the views used to render the participants video.

Using Call#getFloorList() will return an ordered array containing Contact ID's.

The first will be the main speaker, it should be displayed in the master view, and others should be displayed as thumbnails.

/** The master view */
private VideoInFrame master;

/** The thumbnail views */
private VideoInFrame[] thumbnails;

@RtccEventListener
public void onFloorListEvent(FloorListEvent event) {
    Call call = event.getCall();
    int[] floorList = call.getFloorList();
    for (int i = 0; i < floorList.length; i++) {
        Contact contact = call.getContact(floorList[i]);
        VideoInFrame frame = i == 0 ? master : thumbnails[i - 1];
        contact.setView(frame);
    }
}