The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.
This document describes how to quickly integrate the Tencent Cloud TEduBoard SDK into your project. If you are using the Interactive Classroom solution, please go to Interactive Classroom Integration.
Development Environment
Android Studio 2.0+
Android 4.2 (SDK API 17) and above
Integrate TEduBoard SDK
You can choose to use Gradle for automatic loading or manually download the AAR and import it into your project. Since the TEduBoard SDK internally uses TIMSDK as the internal signaling channel, you also need to automatically or manually add TIMSDK dependencies.
Automatic Loading (AAR)
TEduBoard SDK and TIMSDK have been released to the Maven Central repository. You can automatically download and update them by configuring Gradle.
implementation (name:"imsdk-plus-6.6.3002", ext:"aar")// Please use the latest version of IM. For more details, please refer to the IM changelog at https://cloud.tencent.com/document/product/269/1606
Among them sdkAppId, userId, userSig, and classId are parameters that need to be filled in by you.
Note
1. Please perform the initialization operation in the main process. If your app uses multiple processes, please avoid repeated initialization.
2. Due to the internal call of HarmonyOS's evaluatejavascript being changed to asynchronous main thread invocation, the whiteboard GET interface waiting on the main thread and synchronously returning results will cause a deadlock. With the premise of continuing to use the GET interface in a synchronous way, the SDK can no longer avoid this internally. Please update to version 2.8.2 or above and use a child thread to call the whiteboard GET related interfaces externally (as shown in the example below). We will optimize the GET related interfaces asynchronously in the future.
newThread(newRunnable(){
@Override
publicvoidrun(){
TEduBoardFileInfo info = board.getFileInfo(fileId);
}
}).start();
2. Listening to whiteboard key events
Listen to whiteboard events within the TEduBoardCallbackonTEBError and onTEBWarning callback methods of the whiteboard event callback interface.
All SDK callbacks are executed on the Main Thread, so you can directly perform UI operations in the callback.
4. Whiteboard Data Synchronization
During the use of the whiteboard, data synchronization (e.g., graffiti data) needs to be performed among different users. The SDK uses IMSDK as the signaling channel by default. You need to implement the initialization, login, and group joining operations of IMSDK yourself to ensure IMSDK is within the specified group when the whiteboard is initialized.
Step 1: Initialize IMSDK
V2TIMSDKConfig timSdkConfig =newV2TIMSDKConfig();
boolean result =V2TIMManager.getInstance().initSDK(context, sdkAppID, timSdkConfig);
If you have other services using IMSDK and expect the lifecycle of IMSDK to be consistent with the lifecycle of the App, please initialize IMSDK in the onCreate method of the Application. Otherwise, please initialize IMSDK before logging in and deinitialize IMSDK after logging out.
1. It is recommended to use the IM REST API to create groups in advance in the backend.
2. Different group types, group features, and the number of members vary. For details, please refer to the IM group system.
5. Terminate the whiteboard
After calling the unInit method, the whiteboard will be completely terminated internally and billing will stop. Please ensure this interface is called.
mBoard.uninit();
If you use IMSDK as the signaling channel, decide whether to exit the group, log out, and deinitialize according to the needs of your business.
If you have other businesses using IMSDK and you wish IMSDK's lifecycle to be consistent with the App's lifecycle, you do not need to call this interface.