Skip to main content
Version: 0.1.x

Render Whiteboard - Android

This guide explains how to dynamically render a whiteboard in your Android application.

Setup WebView

  • The whiteboard is rendered using a WebView component.
  • You can configure the required XML style using the following code
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

Render the Whiteboard

You can start the whiteboard with meeting.startWhiteboard() method, which triggers the onWhiteboardStarted() event. The event provides the URL to load in the WebView for rendering. To stop it, call meeting.stopWhiteboard(), which triggers the onWhiteboardStopped() event.

class MeetingActivity : AppCompatActivity() {

private lateinit var meeting: Meeting
private lateinit var webView: WebView

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_meeting)

webView = findViewById(R.id.webView)

// Init and config meeting
// meeting = ...

meeting.addEventListener(meetingEventListener);

val meetingEventListener = object : MeetingEventListener() {
override fun onWhiteboardStarted(url: String) {
super.onWhiteboardStarted(url)
webView.loadUrl(url)
webView.settings.javaScriptEnabled = true
webView.webViewClient = WebViewClient()
}

override fun onWhiteboardStopped() {
super.onWhiteboardStopped()
//...
}
}

findViewById<View>(R.id.btnStartWhiteboard).setOnClickListener {
meeting.startWhiteboard()
}

findViewById<View>(R.id.btnStopWhiteboard).setOnClickListener {
meeting.stopWhiteboard()
}
}
}

API Reference

Got a Question? Ask us on discord