Skip to content

Shutdown the SDK

For the application, if you need to shutdown the program and release the resource, or logout, or need reinitialize SDK, you need to terminate it reasonably by calling shutdown() first.

Shutdown DriveMotion in synchronous [Deprecated]

Shutdown in synchronous is deprecated in release 1.2.1 and will be removed in few releases, please using asynchronous shutdown instead.

1
2
3
4
5
    try {
        DriveMotionService.shutdown();
    } catch (DriveMotionException e) {
        // SDK shutdown error or SDK has not been initialized
    }
1
2
3
4
5
    try {
        DriveMotionService.shutdown()
    } catch (e: DriveMotionException) {
        // SDK shutdown error or SDK has not been initialized
    }

Shutdown DriveMotion in asynchronous

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    DriveMotionService.shutdown(new DriveMotionServiceHandler() {
        @Override
        public void handle(boolean isSuccess, @Nullable DriveMotionException exception) {
            if (isSuccess) {
                // Shutdown success
            } else {
                // SDK shutdown error or SDK has not been initialized.
            }
        }
    });
1
2
3
4
5
6
7
    DriveMotionService.shutdown { result, e ->
        if (result) {
            // Shutdown success
        } else {
            // SDK shutdown error or SDK has not been initialized.
        }
    }