Skip to main content

Usage: SDK initialization

Set your credentials and get authorization of usage.

Initialize

To initialize call initRook with the following parameters:

  • clientUUID
  • secret
  • environment
  • packageName (Optional, if not provided, the SDK will retrieve it from Context.):
val environment = if (BuildConfig.DEBUG) SHEnvironment.SANDBOX else SHEnvironment.PRODUCTION
val configuration = SHConfiguration(clientUUID, secret, environment)

if (BuildConfig.DEBUG) {
rookSamsung.enableLocalLogs() // MUST be called first if you want to enable logs
}

rookSamsung.initRook(configuration).fold(
{
// Success
},
{
// Handle error
}
)
tip

You should only initialize the SDK once per app launch.

Critical Requirement

You must register your applicationId (package name) and its corresponding secret in the ROOK Portal before attempting to initialize the SDK. Failure to register these credentials will cause the initialization to fail with an SHNotAuthorizedException.

The ROOK Portal supports independent configurations for Sandbox and Production environments. Each environment requires its own unique pair of Package Name and secret

If you come from a previous version you MUST re-initialize the SDK with the new authentication flow.