Class SdkSessionManager

java.lang.Object
com.digimarc.dms.session.SdkSessionManager

public class SdkSessionManager extends Object
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 Details

    • getInstance

      public static SdkSessionManager getInstance()
      Retrieves the singleton instance of the SdkSessionManager.
      Returns:
      The singleton instance of the SdkSessionManager.
    • createSessionParameters

      public SdkSession.SessionParameters createSessionParameters()
      Creates and returns a new instance of SdkSession.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

      public SdkSessionInitializationResult startSession(SdkSession.SessionParameters sdkSessionParameters)
      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.
      
       <meta-data android:name="com.digimarc.LicenseKey"
                 android:value="license-key-goes-here">
       
      The 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)