ScanningSdkLibrary Object
object ScanningSdkLibrary : Tag
Entry point to the document-scanning SDK: loads the native engine, applies your licence, and reports what this build is.
Call one of the load overloads once, from Application.onCreate, before creating any other SDK object. Loading installs the licence that every object created afterwards inherits; without it the SDK still works, but everything it produces carries a watermark.
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
ScanningSdkLibrary.load(this)
}
}
The order matters and is not recoverable: an SDK object constructed before load is bound to the unlicensed state for as long as it exists, and licensing it afterwards does not affect it. See Instance for the detail.
Types
Feature
enum Feature : Enum<ScanningSdkLibrary.Feature>
The separately licensed capabilities of the SDK, for checking what your key actually covers.
Helper
class Helper : ScanningSdkLibrary.Instance
A minimal Instance whose only job is to guarantee the native library is loaded.
Instance
abstract class Instance : AutoCloseable
Base class of every SDK object backed by memory the Java garbage collector does not manage.
VersionInfo
class VersionInfo
Build provenance of the SDK library: name is the release version (numeric MAJOR.MINOR.PATCH, the published artifact version), build is the SDK repository’s commit count at build time, and gitHash is the short hash of the exact commit the library was built from.
Properties
COLOR_HINT
const val COLOR_HINT: String
Metadata key holding the colour hint that guides processing, as an ordinal.
DEVICE
const val DEVICE: String
Metadata key holding the capture device code, as returned by Device.toInt.
ISO
const val ISO: String
Metadata key holding the camera ISO sensitivity the page was captured at.
log
open override val log: Tag.Log
SHADOWS
const val SHADOWS: String
Metadata key marking whether the page contains shadowed or unevenly lit areas: 1 if it does, 0 if it does not.
TAG
open override val TAG: String
versionInfo
@JvmStatic val versionInfo: ScanningSdkLibrary.VersionInfo
The version, build number, and source commit of this SDK build. Available from Java through the static getter getVersionInfo().
Functions
isLicenceValid
@JvmStatic @JvmOverloads fun isLicenceValid(flags: EnumSet<ScanningSdkLibrary.Feature> = Feature.NONE): Boolean
Reports whether the loaded licence is valid and covers the features you name.
load
@JvmStatic fun load(application: Application): Boolean
Loads the SDK using a licence key shipped in your application’s assets.
@JvmStatic fun load(application: Application, @StringRes resId: Int)
Loads the SDK using a licence key held in a string resource.
@JvmStatic fun load(application: Application, licenseKey: String)
Loads the SDK using a licence key you supply directly.
retrievePicture
@JvmStatic fun retrievePicture(context: Context, uri: Uri): <Error class: unknown class>
Loads a page previously written by stashPicture.
stashPicture
@JvmStatic fun stashPicture(picture: ScanPicture, file: File): Uri
Writes a page to a file you choose and returns a URI for it.
@JvmStatic fun stashPicture(context: Context, picture: ScanPicture, autoDelete: Boolean = false): Uri
Writes a page to a cache file and returns a URI for it.
unpackLanguageFile
@JvmStatic fun unpackLanguageFile(languageFile: File, languagesDir: File): String
Installs a packed OCR language file into a directory ScanReader can read from.