Package com.digimarc.dms.session
Class SdkSessionManager
java.lang.Object
com.digimarc.dms.session.SdkSessionManager
The
SdkSessionManager
class manages sessions for the SDK.
It provides methods for creating sessions and creating session's parameters.
Example usage:
SdkSessionManager sessionManager = SdkSessionManager.getInstance();
SdkSession.SessionParameters sessionParameters = sessionManager.createSessionParameters();
// Customize session parameters if needed
SdkSessionInitializationResult sessionResult = sessionManager.startSession(sessionParameters);
if (sessionResult.isSuccessful()) {
SdkSession session = sessionResult.getSessionOrNull();
// session has been created successfully
} else {
// session creation failed with an error
throw new RuntimeException("SdkSession cannot be created. Error: " + sessionResult.getError());
}
-
Method Summary
Modifier and TypeMethodDescriptionCreates and returns a new instance ofSdkSession.SessionParameters
.static SdkSessionManager
Retrieves the singleton instance of theSdkSessionManager
.startSession
(SessionParameters sdkSessionParameters) Create a session.
-
Method Details
-
getInstance
Retrieves the singleton instance of theSdkSessionManager
.- Returns:
- The singleton instance of the
SdkSessionManager
.
-
createSessionParameters
Creates and returns a new instance ofSdkSession.SessionParameters
. This method is used to obtain a set of parameters for configuring a new SDKSession. The returned session parameters can be customized before creating a new session.- Returns:
- A new
SdkSession.SessionParameters
instance.
-
startSession
Create a session. If license key is null then it will be loaded from the application's manifest. To add your license key to the manifest, create an entry similar to the following inside the<application>
section.
The<meta-data android:name="com.digimarc.LicenseKey" android:value="license-key-goes-here">
android:value=""
entry can either contain your key string itself or it can contain an Android path to a string resource (i.e. "@string/license_key").- Parameters:
sdkSessionParameters
- parameters of session to be created- Returns:
- SdkSessionInitializationResult. If not successful result object will contain
error code (see
SdkSessionInitializationResult.Errors
)
-