Start lesson

In this example, two agents are used: SessionManageAgent and DiscoveryAgent.

Objective — The teacher has to start the lesson. To achieve this, perform the following steps:

1. Identify the teacher by your application login logic.

2. Initializes the SDK by creating an AgentManager instance like below:


3. Get SessionManageAgent from AgentManager.

SessionManageAgent sessionManager = (SessionManageAgent) agentManager.getAgent(AgentConstants.SESSION_MANAGING_AGENT);

4. Register session manager to SessionStatusListener.


5. Call the start course API method of the SessionManageAgent by passing the course ID and course name.

sessionManager.startSession(Course ID, Course name, password,timeoutSecs); 

6. Once the session is started from the SessionManageAgent’s SessionStatusListener, get DiscoveryAgent from AgentManager.

DiscoveryAgent discoveryAgent = (DiscoveryAgent) agentManager.getAgent(AgentConstants.DISCOVERY_AGENT);

7. Set DiscoveryAgent’s Interface mode (Wi-Fi). For more details, see DiscoveryAgent.


8. Create the SessionAnnounceInfo object with the session name, Master (teacher's) name, and so on.

SessionAnnounceInfo courseAnnounceInfo = new SessionAnnounceInfo();
courseAnnounceInfo.sessionName = courseNameEdit.getText().toString();

9. Start announcing the session information by using the DiscoveryAgent.


Once it starts announcing the session, all the users who are connected to the same network will start getting the session. To receive session announcement, the receiver needs to register SessionInfoAnnouncedListener after initializing the SDK.