Feature Switching

You can customize the experience and features available in the Capture through the use of feature toggles.

Available Feature Toggles

DescriptionDefault valueiOS PropertyAndroid Property
Enables the auto-capture featuretrueenableAutoCaptureenableAutoCapture
Starts the capture screen with auto-capture mode
Note: auto-capture feature must be enabled
truedefaultToAutoCaptureinitialAutoCaptureState
Enables the ability to toggle the phone’s flash on/off to help capture in low-light situationstrueenableFlashallowFlashToggling
(Android only) Sets the flash mode that will be set by default when the capture flow begins
Note: flash feature must be enabled
FlashMode.FLASH_MODE_AUTON/AdefaultFlashMode
Enables the tips featuretrueenableCaptureTipsenableCaptureTips
Enables the visibility of feedback while capturing document.trueenableCaptureProgressFeedbackenableCaptureProgressFeedback
Enables the user to select an image from their phone’s image gallerytrueenableImageGalleryenableGalleryImport
Enables the long document capture feature - capturing a longer document composed from a top and bottom imagetrueenableLongCaptureenableLongCapture
Enables toast on the long document capture screen.
Note: Long document capture must be enabled.
trueenableLongReceiptPageToastenableLongReceiptPageToast
Enables the ability to crop captured imagestrueenableCropenableCrop
Determines the maximum number of documents a user can capture in a single capture session. The number must be in 1-10 range.1maxImagesmaxImages
Enables the ability to attach the device’s current location to the image being captured. Requires location permission to have been granted by the user before launching capture. Ensure your app has appropriate location permissionfalseattachLocationDataattachLocationData
Ensures that the images returned as a result of capture comply with the size and quality requirements of Sensibill API.
Note: this flag can only be changed if using standalone capture.
truecompressForSensibillApicompressForSensibillApi
(Android only) Will cause the capture flow to set the WindowManager.LayoutParams.FLAG_SECURE flag in order to prevent users from taking screenshots from within the flowfalseN/AenableSecureWindow
(Android only) Informs capture what type of document is being captured. Currently, this changes some configuration restrictions and what types of strings are displayed to the userCaptureDocumentType.RECEIPTN/AdocumentType
(Android only) A bundle of string resource references defining what string resources will be used in some document type specific locations (eg. “top of receipt” vs “top of invoice”)DocumentTypeStrings.defaultReceiptStringsN/AdocumentTypeStrings
(iOS only) Enables a blur warning on the preview screen after capturingtrueenableBlurDetection
(Note: this feature is only available on the iPhone 6s and newer)
N/A

Reference

iOS Capture.FeatureFlags
Android CaptureConfig

Instructions

Capture provides a Capture.FeatureFlags configuration class to toggle the Capture features listed above. Once the Capture.FeatureFlags instance has been created and adjusted to satisfy the app’s needs, it is passed to Capture.RuntimeSettings (together with the Branding) to construct a Capture.RuntimeSettings for a specific document type (receipt or invoice).

This process is explained in more detail in the Branding Implementation section of the Global Theme page.

Steps:

  1. (Optional) Follow steps 1 - 3 of the Branding Implementation section of the Global Theme page if you wish to provide custom branding. You can skip this step to use default branding (as in the example below).

  2. Create an instance of Capture.FeatureFlags and customize it based on your app’s needs.

  3. Pass a created Capture.FeatureFlags instance to the appropriate document-type-specfic Capture.RuntimeSettings.

  4. Follow steps 6 and 7 of the Branding Implementation section of the Global Theme page

// 2. Create an instance
let featureFlags: Capture.FeatureFlags = .default
featureFlags.attachLocationData = true // An example of modified feature flag

// 3. Pass a created Capture.FeatureFlags object to the Capture.RuntimeSettings
let receiptRuntimeSettings = Capture.RuntimeSettings.receipt(featureFlags: featureFlags)

// Pass the created Capture.RuntimeSettings to CaptureNavigationController
let capture = CaptureNavigationController(settings: receiptRuntimeSettings)

// ...

Depending on your use case for capture, the method for feature customization may change. Please find below the appropriate method for your use case.

Customizing the Default CaptureConfig

By default, every created instance of the capture flow will use the default CaptureConfig object: CaptureConfig.defaultConfig.

This default CaptureConfig can be modified to globally change the default capture configuration. Once a new default config has been set, every subsequent instance of any capture use case will use that default, unless otherwise directly overridden.

This property lives in a Kotlin object (singleton), so it should be customized either in your Application.onCreate, or when you set up the SensibillSDK. The customized values will then be used from that point onward.

Kotlin

// Use default settings, overriding the maximum captured image limit to be 5
CaptureConfig.defaultConfig = CaptureConfig.defaultConfig.copy(
    maxImages = 5
)

Java

// Use default settings, overriding the maximum captured image limit to be 5
final CaptureConfig intendedDefaultConfig = new CaptureConfig(
        true,
        true,
        FlashMode.FLASH_MODE_AUTO,
        true,
        true,
        true,
        true,
        5,
        true,
        true,
        false,
        false,
        true,
        true
);
CaptureConfig.Companion.setDefaultConfig(intendedDefaultConfig);

Reference

CaptureConfig
default CaptureConfig


Customizing Capture Launched From the Spend Manager UI

The only way to customize capture launched from the Spend Manager UI is to change the default CaptureConfig (see previous section).


Customizing Capture for Capture Flow

When customizing capture when using the Capture Flow, use CaptureConfig’s built in copy method to create a modified copy of the default configuration for use with the Capture Flow.

Kotlin

val config = CaptureConfig.defaultConfig.copy(
    allowFlashToggling = false,
    enableLongCapture = false
)

Java

final CaptureConfig config = new CaptureConfig(
        false,
        FlashMode.FLASH_MODE_AUTO,
        false,
        true,
        true,
        true,
        true,
        false,
        1,
        false,
        true,
        true,
        true,
        true
);

Reference Launching the Capture Flow
default CaptureConfig

Customizing Standalone Capture

When customizing capture when Standalone Capture directly, create a new CaptureConfig to be passed as an Intent extra to the StandaloneCaptureActivity, or as an argument to a CaptureImages ActivityResultLauncher.launch() call.

Kotlin

val config = CaptureConfig(
    allowFlashToggling = false,
    enableLongCapture = false
)

Java

final CaptureConfig config = new CaptureConfig(
        false,
        FlashMode.FLASH_MODE_AUTO,
        false,
        true,
        true,
        true,
        true,
        true,
        3,
        false,
        true,
        true,
        true,
        true
);

Reference Launching Standalone Capture
CaptureConfig

Capturing Location Metadata

Capture can attach current location metadata to the EXIF of captured images, nd can preserve the location metadata for images selected from the photo gallery on Android and photo library on iOS (if available). With default configuration, Capture does not collect location metadata, and does not preserve location metadata for images selected from the photo gallery / library. Follow the steps below to enable location metadata collection.

Steps

  1. Enable the location feature flag in Capture.FeatureFlags as explained on Capture Feature Flags

  2. Ensure that NSLocationWhenInUseUsageDescription entitlement (displayed as Privacy - Location when in use usage description) to your application’s Info.plist as explained in the Installation section of the Get Started page.

If the user allows to collect the location where the image is taken, the location will become part of the image metadata.

You can also access the location metadata in CLLocation format, using getLocation() function, implemented in Sensibill SDK’s Data extension:

func captureNavigationController(_ controller: CaptureNavigationController, didFinishCapture result: CaptureResult) {

    ...

    // Get image location metadata
    for image in result.images {
        print(image.getLocation())
    }
}