Skip to main content
Android
iOS
Web

Fastboard quickstart

The Fastboard SDK is the latest generation of the Interactive Whiteboard SDK launched by Agora to help developers quickly build whiteboard applications. The Fastboard SDK simplifies the APIs of the Interactive Whiteboard SDK and adds UI implementations. These improvements enable you to join a room with just a few lines of code and instantly experience real-time interactive collaboration using a variety of rich editing tools. In addition, the Fastboard SDK integrates window-manager and extensions from netless-app, which allows developers to easily extend the functionality of their whiteboard applications and enrich their users' collaboration experience.

This page explains how to quickly join a whiteboard room and experience the interactive whiteboard features using the Fastboard SDK.

Understand the tech

The following figure shows the workflow to join a whiteboard room:

When an app client requests to join a whiteboard room, the app client and your app server interact with the Interactive Whiteboard server in the following steps:

  1. The app server sends a request with the SDK token to the Interactive Whiteboard server to create a whiteboard room.

  2. The Interactive Whiteboard server returns the room UUID to the app server when a room is created successfully.

  3. The app server generates a room token using the returned room UUID and sends the room token and UUID to the app client.

  4. The app client calls createFastRoom and join of the Fastboard SDK to create a FastRoom instance and join the interactive whiteboard room.

Prerequisites

Before proceeding, make sure you meet the following requirements:

Implementations on your app server

Before an app client can join an interactive whiteboard room, your app server needs to call the Agora Restful APIs to create a room, get the room UUID, generate a room token, and pass the room UUID and room token to the app client.

Create a whiteboard room

Call /v5/rooms (POST) on your app server to create a room.

You can use the following Node.js script as a request example:


_17
var request = require("request");
_17
var options = {
_17
"method": "POST",
_17
"url": "https://api.netless.link/v5/rooms",
_17
"headers": {
_17
"token": "Your SDK Token",
_17
"Content-Type": "application/json",
_17
"region": "us-sv"
_17
},
_17
body: JSON.stringify({
_17
"isRecord": false
_17
})
_17
};
_17
request(options, function (error, response) {
_17
if (error) throw new Error(error);
_17
console.log(response.body);
_17
});

If the request is successful, Agora's Interactive Whiteboard server returns information about the created room, including uuid, which is the unique identifier of the room. You need to pass in this parameter when an app client joins the room.

The following is a response example:


_8
{
_8
"uuid": "4a50xxxxxx796b", // The room UUID
_8
"teamUUID": "RMmLxxxxxx15aw",
_8
"appUUID": "i54xxxxxx1AQ",
_8
"isBan": false,
_8
"createdAt": "2021-01-18T06:56:29.432Z",
_8
"limit": 0
_8
}

Generate a room token

After creating a room and getting the uuid of the room, your app server needs to generate a room token and send it to the app client. When an app client joins a room, Agora's server uses the room token for authentication.

To generate a room token on your app server, you can use one of the following methods:

You can use the following Node.js script as a request example:


_17
var request = require('request');
_17
var options = {
_17
"method": "POST",
_17
// Replace <Room UUID> with the uuid of your room
_17
"url": "https://api.netless.link/v5/tokens/rooms/<Room UUID>",
_17
"headers": {
_17
"token": "Your SDK Token",
_17
"Content-Type": "application/json",
_17
"region": "us-sv"
_17
},
_17
body: JSON.stringify({"lifespan":3600000,"role":"admin"})
_17
_17
};
_17
request(options, function (error, response) {
_17
if (error) throw new Error(error);
_17
console.log(response.body);
_17
});

If the request is successful, Agora's server returns a room token. The following is a response example:


_1
"NETLESSROOM_YWs9XXXXXXXXXXXZWNhNjk" // Room token

Implementations on the app client

The following sections show how to use the Fastboard SDK to join a whiteboard room from your Android app.

Create an Android project

Follow these steps to create the environment necessary to add whiteboard functionality into your app.

  1. For new projects, in Android Studio, create a Phone and Tablet Android project with an Empty Activity. After creating the project, Android Studio automatically starts gradle sync. Ensure that the sync succeeds before you continue.

  2. In the /Gradle Scripts/build.gradle(Module: <projectname>.app) file, add the following line to the dependencies field to integrate the Fastboard SDK:


    _4
    dependencies {
    _4
    ...
    _4
    implementation 'com.github.netless-io:fastboard-android:1.2.0'
    _4
    }

You can find the latest SDK version number in the Release notes.

Create the user interface (UI)

The Fastboard SDK provides FastboardView, which is a whiteboard view with a default UI. Adding it to your project's layout enables users to see the whiteboard view when the app runs.

In /app/res/layout/activity_main.xml, replace the content with the following:


_14
<?xml version="1.0" encoding="utf-8"?>
_14
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
_14
xmlns:tools="http://schemas.android.com/tools"
_14
android:layout_width="match_parent"
_14
android:layout_height="match_parent"
_14
xmlns:app="http://schemas.android.com/apk/res-auto"
_14
tools:context=".MainActivity">
_14
_14
<io.agora.board.fast.FastboardView
_14
android:id="@+id/fastboard_view"
_14
android:layout_width="match_parent"
_14
android:layout_height="match_parent" />
_14
_14
</androidx.constraintlayout.widget.ConstraintLayout>

Join the whiteboard room

To join the Interactive Whiteboard room, do the following:

  1. Call getFastboard of the FastboardView class to get the Fastboard instance.

  2. Call createFastRoom of the Fastboard class to create the FastRoom instance. When calling createFastRoom, you must pass the following properties in the roomOptions parameter:

    • appIdentifier: The App Identifier of the whiteboard project in Agora Console. See Get security credentials for your whiteboard project.

    • uuid: The room UUID, the unique identifier of a whiteboard room. See Create a room.

    • token: The room token used for authentication. The room token must be generated using the room UUID above. See Generate a room token.

    • uid: The unique identifier of a user in string format. The maximum length is 1,024 bytes.

    • fastRegion: The data center, which must be the same as the data center you chose when creating the room.

In /app/java/com.example.<projectname>/MainActivity, add the following lines:


_43
package com.example.fastboardquickstart
_43
_43
import android.content.pm.ActivityInfo
_43
import androidx.appcompat.app.AppCompatActivity
_43
import android.os.Bundle
_43
import android.os.Handler
_43
import android.widget.Button
_43
import io.agora.board.fast.FastboardView
_43
import io.agora.board.fast.model.FastRegion
_43
import io.agora.board.fast.model.FastRoomOptions
_43
import java.lang.Exception
_43
_43
class MainActivity : AppCompatActivity() {
_43
override fun onCreate(savedInstanceState: Bundle?) {
_43
super.onCreate(savedInstanceState)
_43
setContentView(R.layout.activity_main)
_43
// Sets the screen orientation as landscape
_43
supportActionBar?.hide()
_43
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
_43
setupFastboard()
_43
_43
}
_43
_43
private fun setupFastboard() {
_43
// Gets the fastboard instance
_43
val fastboardView = findViewById<FastboardView>(R.id.fastboard_view)
_43
val fastboard = fastboardView.fastboard
_43
_43
// Sets room configuration parameters
_43
val roomOptions = FastRoomOptions(
_43
"The App Identifier of your whiteboard project",
_43
"The room UUID",
_43
"The room Token",
_43
"The unique identifier of a user",
_43
FastRegion.US_SV
_43
)
_43
_43
// Creates the FastRoom instance
_43
val fastRoom = fastboard.createFastRoom(roomOptions)
_43
// Joins the whiteboard room
_43
fastRoom.join()
_43
}
_43
}

Build and run the project

Build the project in Android Studio, and run it on a simulator or a physical mobile device. If the project runs successfully, you can see the following page:

You can select the pencil, text, or shape tools on the left toolbar to write and draw on the whiteboard. When the current page is full, you can click the icon at the bottom to add a new page, and use the arrows to switch pages.

Next steps

After experiencing the basic whiteboard functionality, you can call APIs of the Fastboard SDK to add images, audio, video, and documents to the whiteboard.

vundefined