Class MicroblinkSDK

java.lang.Object
com.microblink.blinkid.MicroblinkSDK

public final class MicroblinkSDK extends Object
Entry class for all Microblink SDKs - used for setting up license key and to add support for optimisation of passing data between activities.
  • Method Details

    • getApplicationContext

      @Nullable public static android.content.Context getApplicationContext()
    • getIntentDataTransferMode

      @NonNull public static IntentDataTransferMode getIntentDataTransferMode()
      Returns current intent data transfer mode.
      Returns:
      current intent data transfer mode.
      See Also:
    • setIntentDataTransferMode

      public static void setIntentDataTransferMode(@NonNull IntentDataTransferMode intentDataTransferMode)
      Sets intent data transfer mode for passing Microblink SDK data between activities. By default, IntentDataTransferMode.PERSISTED_OPTIMISED is used.
      Parameters:
      intentDataTransferMode - requested data transfer mode
      See Also:
    • setShowTrialLicenseWarning

      public static void setShowTrialLicenseWarning(boolean showTrialLicenseWarning)
      Disable or enable showing of toast when trial license key is entered. By default, whenever someone uses trial license key, a toast will appear informing user that license is trial. This feature should protect you from accidentally using trial license key in production version of your app.
      Parameters:
      showTrialLicenseWarning - whether or not warning for using trial license should be shown
    • getNativeLibraryVersionString

      @NonNull public static String getNativeLibraryVersionString()
      Methods returns the version string of native library, if it has been loaded. If native library is not loaded, method returns string "native library not loaded".
      Returns:
      version string of native library
    • setLicenseBuffer

      public static void setLicenseBuffer(@NonNull byte[] licenseBuffer, @NonNull android.content.Context applicationContext)
      Set license buffer and unlock the SDK. Application package will be used to validate the license.
      Parameters:
      licenseBuffer - Byte array containing the license.
      applicationContext - Application context.
      Throws:
      InvalidLicenceKeyException - if license is not valid
    • setMicroblinkProxyUrl

      public static void setMicroblinkProxyUrl(@NonNull String url)
      Set custom URL for Ping and licence check (used as a proxy). If you need to set the proxy URL, you should do it before setting the license key; otherwise this call won't have any effect. Proxy URL will be applied if the correct license right exists; otherwise InvalidLicenceKeyException will be thrown when setting the license key.
      Parameters:
      url - String containing the desired URL base. URL has to use HTTPS protocol.
      Throws:
      IllegalArgumentException - if the URL is not using HTTPS protocol.
    • setLicenseBuffer

      public static void setLicenseBuffer(@NonNull byte[] licenseBuffer, @NonNull String licensee, @NonNull android.content.Context applicationContext)
      Set license buffer and unlock the SDK. Also define licensee that will be used to validate the license. This method can be used to unlock the SDK in library mode, i.e. when Microblink SDK is being packaged inside 3rd party SDK. Unlocking Microblink SDK in library mode allows usage of single license within multiple application packages.
      Parameters:
      licenseBuffer - Byte array containing the license.
      licensee - Licensee to which license is given to.
      applicationContext - Application context.
      Throws:
      InvalidLicenceKeyException - if license is not valid
    • setLicenseKey

      public static void setLicenseKey(@NonNull String base64LicenseKey, @NonNull android.content.Context applicationContext)
      Set license key and unlock the SDK. Application package will be used to validate the license.
      Parameters:
      base64LicenseKey - License file encoded as base64 string.
      applicationContext - Application context.
      Throws:
      InvalidLicenceKeyException - if license is not valid
    • setLicenseKey

      public static void setLicenseKey(@NonNull String base64LicenseKey, @NonNull String licensee, @NonNull android.content.Context applicationContext)
      Set license key and unlock the SDK. Also define licensee that will be used to validate the license. This method can be used to unlock the SDK in library mode, i.e. when Microblink SDK is being packaged inside 3rd party SDK. Unlocking Microblink SDK in library mode allows usage of single license within multiple application packages.
      Parameters:
      base64LicenseKey - Byte array containing the license.
      licensee - Licensee to which license is given to.
      applicationContext - Application context.
      Throws:
      InvalidLicenceKeyException - if license is not valid
    • setLicenseFile

      public static void setLicenseFile(@NonNull String licenseFilePath, @NonNull android.content.Context applicationContext)
      Set the license file and unlock the SDK. Application package will be used to validate the license.
      Parameters:
      licenseFilePath - Path inside assets where license file should be loaded from.
      applicationContext - Application context required to access asset manager.
      Throws:
      InvalidLicenceKeyException - if license is not valid
    • setLicenseFile

      public static void setLicenseFile(@NonNull String licenseFilePath, @NonNull String licensee, @NonNull android.content.Context applicationContext)
      Set the license file and unlock the SDK. Also define licensee that will be used to validate the license. This method can be used to unlock the SDK in library mode, i.e. when Microblink SDK is being packaged inside 3rd party SDK. Unlocking Microblink SDK in library mode allows usage of single license within multiple application packages.
      Parameters:
      licenseFilePath - Path inside assets where license file should be loaded from.
      applicationContext - Application context required to access asset manager.
      Throws:
      InvalidLicenceKeyException - if license is not valid