arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Connecting SDK to API

To connect SDK to Oz API, specify the API URL and access token as shown below.

OzLivenessSDK.setApiConnection(OzConnection.fromServiceToken(host, token))
OzLivenessSDK.INSTANCE.setApiConnection(
        OzConnection.Companion
circle-exclamation

Please note:

  • In your host application, it is recommended that you set the API address on the screen that precedes the liveness check. Setting the API URL initiates a service call to the API, which may cause excessive server load when being done at the application initialization or startup. We recommend calling the setApiConnection method once, for example, in the Application class.

  • The order of SDK initialization and API connection does not matter, but both methods must be finished successfully before invoking the createStartIntent method.

Alternatively, you can use the login and password provided by your Oz Forensics account manager:

Although, the preferred option is authentication via access token – for security reasons.

By default, logs are saved along with the analyses' data. If you need to keep the logs distinct from the analysis data, set up the separate connection for as shown below:

Clearing authorization:

hashtag
Other Methods

Check for the presence of the saved Oz API access token:

LogOut:

.
fromServiceToken
(
host
,
token
),
null
);
telemetry
OzLivenessSDK.setApiConnection(
    OzConnection.fromCredentials(host, username, password),
    statusListener(
        { token -> /* token */ },
        { ex -> /* error */ }
    )
)
OzLivenessSDK.INSTANCE.setApiConnection(
        OzConnection.Companion.fromCredentials(host, username, password),
        new StatusListener<String>() {
            @Override
            public void onStatusChanged(@Nullable String s) {}
            @Override
            public void onSuccess(String token) { /* token */ }
            @Override
            public void onError(@NonNull OzException e) { /* error */ 
        }
);
OzLivenessSDK.setEventsConnection(
    OzConnection.fromCredentials(
        "https://echo.cdn.ozforensics.com/",
        "<[email protected]>",
        "your_telemetry_password"
    )
)
OzLivenessSDK.setEventsConnection(
        OzConnection.fromCredentials(
                "https://tm.ozforensics.com/",
                "<[email protected]>",
                "your_telemetry_password"
        )
);
OzLivenessSDK.setApiConnection(null)
OzLivenessSDK.INSTANCE.setApiConnection(null, null);
val isLoggedIn = OzLivenessSDK.isLoggedIn
boolean isLoggedIn = OzLivenessSDK.INSTANCE.isLoggedIn();
OzLivenessSDK.logout()
OzLivenessSDK.INSTANCE.logout();
}