Class SORIConfig

  • All Implemented Interfaces:

    
    public final class SORIConfig
    
                        

    Configuration class for SORI SDK network handling and offline support behavior.

    This configuration allows you to customize how the SDK handles network failures and manages offline scenarios. You can control whether failed requests are queued, how long they're retained, and whether they're automatically retried.

    The SDK provides three main configuration parameters:

    • enableDelayedSending: Controls whether to queue failed requests

    • maxPendingTimeMillis: Sets the maximum age for queued requests

    • autoRetryOnNetworkRecovery: Controls automatic retry behavior

    • requirePatternMarkerForCampaign: Drops material hits that have no marker

    • allowPackagedModelOnAuthenticationFailure: Allows diagnostics-only offline capture

    • suppressCampaignRequests: Captures recognition events without posting campaign activity

    • captureOnlyRecognition: Captures and buffers PCM windows without detector or matcher work

    • featureOnlyRecognition: Captures PCM and extracts AFP windows without matcher work

    • markerOnlyRecognition: Captures only near-ultrasonic marker codes and skips AFP matching

    • audiomarker: Enables low-latency marker scanning alongside full-cadence AFP recognition

    • enablePatternMarkerRecognition: Deprecated compatibility field; use audiomarker

    • sparseMaterialRecognition: Runs AFP material windows at the full fingerprint cadence

    • splitPatternMarkerRecognition: Runs pattern marker detection on its own low-latency cadence

    val config = SORIConfig(
        enableDelayedSending = true,
        maxPendingTimeMillis = 600000L, // 10 minutes
        autoRetryOnNetworkRecovery = true
    )
    
    val recognizer = SORIAudioRecognizer(apiKey, secretKey)
    recognizer.setConfig(config)
    Since:

    1.0.0

    • Constructor Detail

      • SORIConfig

        SORIConfig(Boolean enableDelayedSending, Long maxPendingTimeMillis, Boolean autoRetryOnNetworkRecovery, Boolean requirePatternMarkerForCampaign, Boolean allowPackagedModelOnAuthenticationFailure, Boolean suppressCampaignRequests, Boolean captureOnlyRecognition, Boolean featureOnlyRecognition, Boolean markerOnlyRecognition, Boolean enablePatternMarkerRecognition, Boolean sparseMaterialRecognition, Boolean splitPatternMarkerRecognition, Boolean audiomarker)
        Creates a new SORIConfig with the specified settings
    • Method Detail

      • getEnableDelayedSending

         final Boolean getEnableDelayedSending()

        Controls whether failed requests due to network unavailability are queued for later delivery.

        • When true: Failed requests are saved to an in-memory queue when network is unavailable

        • When false: Failed requests are immediately discarded when network is unavailable

        Important: When network is available, requests are always sent immediately regardless of this setting. This option only affects behavior when network is unavailable.

        Default: true

      • getMaxPendingTimeMillis

         final Long getMaxPendingTimeMillis()

        Maximum time in milliseconds to keep pending requests in the queue.

        Requests older than this duration will be automatically discarded when the queue is processed. This prevents stale requests from being sent long after they were originally intended.

        Default: 600000 (10 minutes)

      • getAutoRetryOnNetworkRecovery

         final Boolean getAutoRetryOnNetworkRecovery()

        Controls whether queued requests are automatically processed when network connectivity is restored.

        • When true: Queued requests are automatically processed when network becomes available

        • When false: Queued requests remain in memory but require manual processing

        This setting only takes effect when enableDelayedSending is true. If enableDelayedSending is false, this setting has no effect since requests are never queued.

        Default: true

      • getRequirePatternMarkerForCampaign

         final Boolean getRequirePatternMarkerForCampaign()

        Controls whether material recognition results must include a pattern marker before the SDK posts activity and dispatches a campaign.

        Default: false

      • getAllowPackagedModelOnAuthenticationFailure

         final Boolean getAllowPackagedModelOnAuthenticationFailure()

        Allows the recognition service to continue with the packaged model when authentication fails. This is intended for local diagnostics apps that collect marker scanner evidence without posting campaign activity.

        Default: false

      • getSuppressCampaignRequests

         final Boolean getSuppressCampaignRequests()

        Prevents the recognition service from posting material recognition hits to the SORI API. No public audio marker discovery is emitted because marker identity can only be resolved by an activity response. This remains useful for internal detector diagnostics where material/campaign matches would bias the eval output.

        Default: false

      • getCaptureOnlyRecognition

         final Boolean getCaptureOnlyRecognition()

        Runs only the AudioRecord capture, PCM endian conversion, hop buffering, silence checks, and recognition-window flattening path.

        This is intended for diagnostics that need to subtract the shared capture floor from marker and material recognition CPU measurements.

        Default: false

      • getFeatureOnlyRecognition

         final Boolean getFeatureOnlyRecognition()

        Runs capture plus FeatureExtractor/AFP window generation, but skips both material matching and near-ultrasonic marker detection.

        This is intended for diagnostics that isolate the AFP feature extraction cost before material matching is added.

        Default: false

      • getMarkerOnlyRecognition

         final Boolean getMarkerOnlyRecognition()

        Runs only the near-ultrasonic marker detector during live recognition.

        This is intended for internal marker-only diagnostics. It does not emit a public marker identity because no activity response resolves the local code. Standalone marker-only capture requires the continuous path on Android 29+. There it requests 48 kHz independently of audiomarker and takes precedence over featureOnlyRecognition; captureOnlyRecognition still suppresses all detector work and selects 16 kHz.

        Default: false

      • getSparseMaterialRecognition

         final Boolean getSparseMaterialRecognition()

        Compatibility flag retained for existing constructors and copies. Material AFP matching always uses a 3.25-second window and full-window stride in continuous capture, independently of marker scanning. Either stored value resolves to true.

      • getSplitPatternMarkerRecognition

         final Boolean getSplitPatternMarkerRecognition()

        Runs near-ultrasonic pattern marker detection in the shared PCM capture loop between material AFP windows. Audio-marker mode always enables this through effectiveSplitPatternMarkerRecognition; an explicit false does not select the old combined detector path. This flag alone does not enable audio-marker recognition.

        Default stored value: false; effective value is true with audiomarker.

      • getAudiomarker

         final Boolean getAudiomarker()

        Runs near-ultrasonic audio marker detection alongside normal AFP material recognition. SORIConfig(audiomarker = true) is sufficient to select split low-latency marker scanning and sparse/full-fingerprint material cadence. The default recognition path is fingerprint-only at 16 kHz. Enabling marker detection selects 48 kHz capture; changing modes restarts capture with the required rate. Capture-only, feature-only, and marker-only diagnostics still take precedence over the corresponding detector/matcher work.

        Default: false