Initializing the SDK
To use the SDK’s methods and classes, your application must call the SDK’s
initialise
method to initialize the
MobileCredentialHolder
class.
MobileCredentialHolder.getInstance().initialise(activity)
Initialize a specific instance
You can initialize this singleton class with one instanceId
at a time:
MobileCredentialHolder.getInstance().initialise(activity, instanceId = "user-2")
Once initialized, all subsequent method calls in this class will only return results specific to
this instanceId
.
If no instanceId
is provided, the default instance is initialized
(00000000-0000-0000-0000-000000000000
).
Configure authentication requirements
You can configure the method to require user authentication (biometric or passcode) upon
initialization using the optional userAuthRequiredOnInitialise
parameter:
MobileCredentialHolder.getInstance().initialise(activity, userAuthRequiredOnInitialise = false)
UX Considerations
Setting userAuthRequiredOnInitialise
to true
would require the user to authenticate when
initializing the SDK.
Configure logger behavior
You can configure the SDK’s logger behavior using the optional loggerConfiguration
parameter:
MobileCredentialHolder.getInstance().initialise(
activity,
loggerConfiguration = Logger.LoggerConfiguration(
logLevel = Logger.LogLevel.DEBUG,
callbackLogLevel = Logger.LogLevel.DEBUG,
callback = { priority, tag, message, error ->
Logger.d("Perform any custom action with the log event: $message")
}
)
)
logLevel
: Determines which events are written to logs.callbackLogLevel
: Determines which events invoke thecallback
function.callback
: Defines the function to call when events defined bycallbackLogLevel
occur.
Logging levels
These levels apply to both the logLevel
and callbackLogLevel
parameters (corresponding raw value
in shown in parenthesis):
- Off (7).
- Assert (7).
- Error (6).
- Warning (5).
- Info (4).
- Debug (3).
- Verbose (2).