Class GeniusScanSDK

java.lang.Object
com.geniusscansdk.core.GeniusScanSDK

public class GeniusScanSDK extends Object
  • Constructor Details

    • GeniusScanSDK

      public GeniusScanSDK()
  • Method Details

    • setLicenseKey

      public static void setLicenseKey(Context context, String licenseKey, boolean autoRefresh)
      Set the Genius Scan SDK license key with optional auto-refresh.

      This method doesn't return an error but will log warnings should the key be invalid or expired. All other SDK methods that return errors will report an error if there is a problem with the license key, and you must handle them to ensure you provide a good "degraded" experience. For instance, you can prompt the user to update the application to use the scanning feature in case they use a version of the application with an expired license key.

      Parameters:
      context - the application or activity context
      licenseKey - a license key, either trial or production
      autoRefresh - true if the license key should automatically refreshed using Genius scan SDK backend
    • setLicenseKey

      public static void setLicenseKey(Context context, String licenseKey)
    • checkInitialization

      public static void checkInitialization() throws LicenseException
      Check if the SDK is correctly initialized.
      Throws:
      LicenseException - if the license is invalid or expired, or if the demo mode is over
    • init

      @Deprecated public static void init(Context context, String licenseKey) throws LicenseException
      Initialize the SDK library
      Parameters:
      context - Application or activity context
      Throws:
      LicenseException
    • setLogger

      public static void setLogger(Logger logger)
      Set the logger used by the SDK.
      Parameters:
      logger - Logger
    • getLogger

      public static Logger getLogger()
      Return the logger used by the SDK. Default implementation logs to the Android console
      Returns:
      Object implementing the Logger interface
    • setJPGQuality

      public static void setJPGQuality(int JPGQuality)
      Sets the JPG quality used to write images
      Parameters:
      JPGQuality - Desired JPG quality (between 0 and 100)
    • rotateImage

      public static void rotateImage(String imageToRotatePath, String rotatedImagePath, RotationAngle angle, boolean isBinary) throws IOException, ProcessingException, LicenseException
      Rotate an image.
      Parameters:
      imageToRotatePath - Path to the input image
      rotatedImagePath - Desired path to the output image
      angle - Rotation angle
      Throws:
      IOException - if input file cannot be read or output folder does not exist
      ProcessingException
      LicenseException
    • rotateImage

      public static void rotateImage(String imageToRotatePath, String rotatedImagePath, RotationAngle angle) throws IOException, ProcessingException, LicenseException
      Throws:
      IOException
      ProcessingException
      LicenseException
    • rotateImage

      public static Bitmap rotateImage(Bitmap in, RotationAngle angle) throws ProcessingException, LicenseException
      Rotate an image.
      Parameters:
      in - Image bitmap to rotate
      angle - Rotation angle.
      Returns:
      The rotated image bitmap
      Throws:
      ProcessingException - if rotation fails (eg if bitmap is not valid)
      LicenseException
    • scaleImage

      public static void scaleImage(String inPath, String outPath, float scalingRatio) throws IOException, LicenseException, ProcessingException
      Create a new scaled image.
      Parameters:
      inPath - Path of the input image
      outPath - Path of the output image
      scalingRatio - Ratio between the output image and the input image
      Throws:
      IOException - if input file cannot be read
      LicenseException
      ProcessingException
    • scaleImage

      public static void scaleImage(String inPath, String outPath, int maxImageSize) throws IOException, LicenseException, ProcessingException
      Scale image so that both dimensions fit inside given size.
      Parameters:
      inPath - Path of the input image
      outPath - Path of the output image
      maxImageSize - Max image size after resize operation
      Throws:
      IOException - if input file cannot be read
      LicenseException
      ProcessingException