Help Center > > API Reference> AgentLite API Reference (Java)> APIs> Access of Directly Connected Devices> Disconnecting a Device

Disconnecting a Device

Updated at: Aug 28, 2019 GMT+08:00

API Function

This API is used to disconnect a device from the IoT platform.

API Description

1
public static boolean logout();

Class

LoginService

Parameter Description

N/A

Return Value

Return Value

Description

true

Success

false

Failure

NOTE:

Return values only show API calling results. For example, the return value true indicates that the API is called successfully but does not indicate that the logout is successful. The logout is successful only after the LoginService broadcast is received.

Example

Call this API to disconnect a device.

1
LoginService. logout();

Implement the observer API provided by the AgentLite before calling this API.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
public class AgentliteLogin implements MyObserver {
    public AgentliteLogin (Observable loginService) {
        loginService. registerObserver (this);
    }
//Override the update method in the AgentliteLogin.
    @Override
    public void update(IotaMessage arg0) {
        // TODO Auto-generated method stub
        System.out.println("LoginManager receives a notification:" + arg0)
        int mMsgType = arg0.getMsgType();
        switch(mMsgType) {
            case 1:
            loginResultAction(arg0);
            break;
            case 2:
            logoutResultAction(arg0);
            break;
            default:
            break;
        }
    }

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel