STRICH Barcode Scanning SDK API Reference
    Preparing search index...

    Class StrichSDK

    Main entrypoint for the STRICH Barcode Scanning SDK, containing initialization and utility methods.

    The SDK has to be initialized with a license key using the StrichSDK.initialize method before barcodes may be scanned.

    Index

    Methods

    • Return the current state of the camera permission.

      Uses the Permissions API (https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API) to determine if the user has granted or denied camera permission or if a prompt will occur when the camera is accessed. In all other cases, the value 'unknown' is returned.

      Returns Promise<"denied" | "granted" | "prompt" | "unknown">

      A Promise resolving to the current state of the camera permission: 'granted' if it is granted, 'denied' if it is denied, 'prompt' if a prompt will occur, and 'unknown' if it could not be determined for any reason.

      The Permissions API is currently not available on Firefox: 'unknown' will be returned.

    • Check if the browser has access to a camera device, which is required for scanning barcodes.

      Returns Promise<boolean>

      A Promise that resolves to a boolean value indicating if a camera is available. The Promise will reject if the check fails for any reason (including missing/denied permissions).

      This can be used as a check if a BarcodeReader should be presented, or a fallback to a manual input method or error page should be displayed.

    • One-time initialization of the SDK

      Parameters

      • licenseKey: string

        The license key obtained from the Customer Portal.

      Returns Promise<void>

      A Promise that resolves when the SDK was initialized successfully, or an SdkError instance.

      For online licenses, this will invoke an HTTPS call to our license service. If possible, we recommend calling this method early in the lifecycle of your scanning flow, to avoid any delay at the time a BarcodeReader instance is required.

    • Returns boolean

      True if the SDK was successfully initialized, false otherwise

    • Override the preferred audio implementation used to emit audible feedback (beeps). By default, the SDK will automatically select an appropriate implementation.

      Parameters

      • impl: "webaudio" | "html5"

        The audio implementation to use, either 'webaudio' for the WebAudio API, or 'html5' for an HTML5 Audio element

      Returns void

      Using this method should only be necessary in specialized environments. Selecting an unsupported implementation will still fall back to an available one.

    • Set a custom ID for additional context.

      Parameters

      • customId: string | null

        The custom ID. Use null to unset the custom ID.

      Returns void

      The custom ID is independent of the device ID, and can be used for custom device identifiers, location identifiers or anonymous user identifiers. Unless you opt out of usage tracking (an Enterprise-only capability), the custom ID will also be available in the CSV export of your scans.

      The custom ID is not a per-scan identifier.

      USING THE CUSTOM ID TO TRANSMIT PERSONALLY IDENTIFYING DATA IS FORBIDDEN AND CONSTITUTES A BREACH OF THE TERMS OF THE LICENSE AGREEMENT.

    • Override the language of built-in error messages shown in the scanning UI. By default, browser's language (navigator.language) will be used.

      Parameters

      • lang: string

        The lower-case ISO language code, e.g. 'en'

      Returns void

    • Returns string

      The semantic version of the SDK, as MAJOR.MINOR.PATCH