Functions that allow an Eitri-App to use the device's camera through the operating system's native APIs.

Methods

Methods

  • Opens the camera and scans selected codes: (qr, aztec, dataMatrix, pdf417, code128 and ean13)

    try {
    const deeplink = await Eitri.exposedApis.camera.startScanner({formats: ["qr_code", "ean_13"]})
    if (!deeplink) {
    setAlertMessage('code not detected')
    setShowErrorAlert(true)
    return
    }
    handleCode(deeplink)
    } catch (error) {
    console.log("startScanner.error: ", error);
    }

    Parameters

    • param: { formats?: [CodeFormats] }

      Object containing an optional "formats" attribute that allowlists which formats are supported.

      • Optionalformats?: [CodeFormats]

        Array of strings representing the formats to be scanned. If not provided, all formats are supported.

    Returns Promise<string>

    returns the content of the code as a string if one is scanned.