Join lesson

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

Objective — Students have to join the lesson. To achieve this, perform the following steps:

1. Identify the student by your application logic.

2. Get DiscoveryAgent from AgentManager.

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

3. Set DiscoveryAgent’s discovery mode and register session info Announce listener.


4. Start receiving session details by DiscoveryAgent.


5. While activity is created and resumed, get the course list and notify to required components and UI.

List<SessionAnnounceInfo> sessionAnnounceInfoList =discoveryAgent.getAnnouncedSessionInfo();	

6. Create session manager by getting SessionManageAgent from AgentManager.

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

7. Register session manager to SessionStatusListener.

sessionManager.registerListener (sessionStatusListener);

8. Call Join Course of Session Manage agent by the required input parameters. Here, info is the subset of sessionAnnounceInfoList.

sessionManager.joinSession(userId, userName, password, info, timeoutSecs);