Class MicroblinkSDK


  • public final class MicroblinkSDK
    extends java.lang.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 Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static android.content.Context getApplicationContext()  
      static IntentDataTransferMode getIntentDataTransferMode()
      Returns current intent data transfer mode.
      static java.lang.String getNativeLibraryVersionString()
      Methods returns the version string of native library, if it has been loaded.
      static void setIntentDataTransferMode​(IntentDataTransferMode intentDataTransferMode)
      Sets intent data transfer mode for passing Microblink SDK data between activities.
      static void setLicenseBuffer​(byte[] licenseBuffer, android.content.Context applicationContext)
      Set license buffer and unlock the SDK.
      static void setLicenseBuffer​(byte[] licenseBuffer, java.lang.String licensee, android.content.Context applicationContext)
      Set license buffer and unlock the SDK.
      static void setLicenseFile​(java.lang.String licenseFilePath, android.content.Context applicationContext)
      Set the license file and unlock the SDK.
      static void setLicenseFile​(java.lang.String licenseFilePath, java.lang.String licensee, android.content.Context applicationContext)
      Set the license file and unlock the SDK.
      static void setLicenseKey​(java.lang.String base64LicenseKey, android.content.Context applicationContext)
      Set license key and unlock the SDK.
      static void setLicenseKey​(java.lang.String base64LicenseKey, java.lang.String licensee, android.content.Context applicationContext)
      Set license key and unlock the SDK.
      static void setShowTrialLicenseWarning​(boolean showTrialLicenseWarning)
      Disable or enable showing of toast when trial license key is entered.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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:
        IntentDataTransferMode
      • 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 java.lang.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
      • setLicenseBuffer

        public static void setLicenseBuffer​(@NonNull
                                            byte[] licenseBuffer,
                                            @NonNull
                                            java.lang.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
                                         java.lang.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
                                         java.lang.String base64LicenseKey,
                                         @NonNull
                                         java.lang.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
                                          java.lang.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
                                          java.lang.String licenseFilePath,
                                          @NonNull
                                          java.lang.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