Package com.geniusscansdk.core
Class GeniusScanSDK
java.lang.Object
com.geniusscansdk.core.GeniusScanSDK
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Check if the SDK is correctly initialized.static Logger
Return the logger used by the SDK.static void
Deprecated.static Bitmap
rotateImage
(Bitmap in, RotationAngle angle) Rotate an image.static void
rotateImage
(String imageToRotatePath, String rotatedImagePath, RotationAngle angle) static void
rotateImage
(String imageToRotatePath, String rotatedImagePath, RotationAngle angle, boolean isBinary) Rotate an image.static void
scaleImage
(String inPath, String outPath, float scalingRatio) Create a new scaled image.static void
scaleImage
(String inPath, String outPath, int maxImageSize) Scale image so that both dimensions fit inside given size.static void
setJPGQuality
(int JPGQuality) Sets the JPG quality used to write imagesstatic void
setLicenseKey
(Context context, String licenseKey) static void
setLicenseKey
(Context context, String licenseKey, boolean autoRefresh) Set the Genius Scan SDK license key with optional auto-refresh.static void
Set the logger used by the SDK.
-
Constructor Details
-
GeniusScanSDK
public GeniusScanSDK()
-
-
Method Details
-
setLicenseKey
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 contextlicenseKey
- a license key, either trial or productionautoRefresh
- true if the license key should automatically refreshed using Genius scan SDK backend
-
setLicenseKey
-
checkInitialization
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.UsesetLicenseKey(Context, String, boolean)
insteadInitialize the SDK library- Parameters:
context
- Application or activity context- Throws:
LicenseException
-
setLogger
Set the logger used by the SDK.- Parameters:
logger
- 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 imagerotatedImagePath
- Desired path to the output imageangle
- Rotation angle- Throws:
IOException
- if input file cannot be read or output folder does not existProcessingException
LicenseException
-
rotateImage
public static void rotateImage(String imageToRotatePath, String rotatedImagePath, RotationAngle angle) throws IOException, ProcessingException, LicenseException -
rotateImage
public static Bitmap rotateImage(Bitmap in, RotationAngle angle) throws ProcessingException, LicenseException Rotate an image.- Parameters:
in
- Image bitmap to rotateangle
- 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 imageoutPath
- Path of the output imagescalingRatio
- Ratio between the output image and the input image- Throws:
IOException
- if input file cannot be readLicenseException
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 imageoutPath
- Path of the output imagemaxImageSize
- Max image size after resize operation- Throws:
IOException
- if input file cannot be readLicenseException
ProcessingException
-
setLicenseKey(Context, String, boolean)
instead