Android Client SDK
This document describes how to install the Nabto WebRTC SDK for Android. This library provides signaling for Android based projects used with the Nabto WebRTC Signaling Service.
Installation
First the project needs to include Jitpack as a maven package source.
dependencyResolutionManagement {
...
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
dependencyResolutionManagement {
...
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
To use the packages in the project the following lines are added to the project configuration.
dependencies {
implementation 'com.github.nabto.nabto-webrtc-sdk-android:core:v0.0.2'
implementation 'com.github.nabto.nabto-webrtc-sdk-android:util:v0.0.2'
implementation 'com.github.nabto.nabto-webrtc-sdk-android:util-org-webrtc:v0.0.2'
}
dependencies {
implementation("com.github.nabto.nabto-webrtc-sdk-android:core:v0.0.2")
implementation("com.github.nabto.nabto-webrtc-sdk-android:util:v0.0.2")
implementation("com.github.nabto.nabto-webrtc-sdk-android:util-org-webrtc:v0.0.2")
}
Quick Start
val productId: String = ... /* initialize your productId */
val deviceId: String = ... /* initialize your deviceId */
val sharedSecret: String = ... /* initialize your sharedSecret */
// Build the signaling client options
val options = SignalingClientFactory.Options()
.setProductId(productId)
.setDeviceId(deviceId)
// Create signaling client
val client = SignalingClientFactory.createSignalingClient(options)
// Create message transport
val messageTransport = ClientMessageTransport.createSharedSecretMessageTransport(client, sharedSecret)
// Add observer and listen for the Setup done event.
messageTransport.addObserver(object : MessageTransport.AbstractObserver() {
override fun onSetupDone(iceServers: List<SignalingIceServer>) {
super.onSetupDone(iceServers)
// Create the WebRTC connection and handle further WebRTC signaling
}
})