SDK Functionality

The Pensa library is a lightweight SDK that simplifies interactions through straightforward method calls. This SDK enables you to:

  • Locate stores: Easily find the stores you're looking for.

  • Access stores directly: Use global store IDs to access a specific store and initiate a scan directly.

  • View store history: Conveniently access a list of previously visited stores.

  • Monitor scan uploads: Track the upload status of your scans.

Searching stores

To initiate a store search using the Pensa SDK, integrate the following code snippet into your Activity or Fragment:

PensaSdk.showStoreSearchView(
    context = this,
    onError = { error ->
        println("Error displaying search store: $error")
    }
)

This will present a search interface where you can input keywords (e.g., store name, location) to find the desired store. Upon selecting a store from the search results, the SDK will automatically redirect you to that store's details, allowing you to begin a scan.

Accessing Stores Directly with Global Store IDs

The Pensa SDK lets you directly access a store and initiate a scan using its global store ID. To do this, use the showStoreChecklist method:

Sending Custom Parameters with Scans

In addition to using global store IDs, the Pensa SDK allows you to send custom parameters along with your scans. This can be useful for including company-specific information or metadata.

To send custom parameters, use the sectionKey and guid parameters in the showStoreChecklist method.

Recently Visited Stores

The Pensa SDK maintains a cache of recently visited stores for easy access and reuse. This allows you to quickly return to a previously scanned store without searching for it again.

Adding Stores to the Cache

A store is automatically added to the "Recently Visited Stores" cache when you:

  • Use the showStoreChecklist() method to access a store.

  • Select a store from the search results after using showStoreSearchView().

Accessing Recently Visited Stores

To display the "Recently Visited Stores" screen, use the following code:

This will present a screen listing the recently visited stores. You can select a store from this screen to access its details and initiate a new scan.

Monitoring Scan Uploads

The Pensa SDK provides convenient methods to monitor the progress of your scan uploads. There are two separate methods depending on the type of scan:

Shelf Scans

To monitor shelf scan uploads, use the following method:

Product Scans

Both methods present a screen that displays the status of each scan upload. You can use these screens to:

  • Track upload progress: Observe the progress of ongoing uploads.

  • View completed uploads: See a history of successfully uploaded scans.

  • Cancel uploads: Stop the upload of any scan that is in progress.

These features give you complete control over your scan uploads and ensure you're always informed about their status.

Stocking Screen

The Pensa SDK allows you to access the stocking screen. This screen is used to review and manage stock actions related to the selected store.

To display the stocking screen, use the following method:

Scan Area

To directly open a scan area, you must provide a scanId and either a storeId or a globalStoreId.:

This method allows you to navigate directly to a scan area without going through the store selection flow.

Scan & Image APIs (Android)

This section documents the programmatic APIs exposed by the Pensa Android SDK that allow you to:

  • Fetch processing statuses for one or more scans.

  • Retrieve on-demand analytical reports for a given scan.

  • Fetch a product image as a Base64‑encoded string.

All examples below assume that:

  • PensaSdk.initPensa(...) has been called successfully, and

  • PensaSdk.isPensaStarted() returns true.


Fetch scan statuses

Method

Use this method to query the processing status and basic metadata for one or more scans.

If the SDK is not initialized, the method calls onError("Pensa SDK is not started.").

Parameters

  • scanIds: List of scan IDs to query.

  • onSuccess: Invoked with a list of PensaScanStatus objects when the request succeeds.

  • onError: Invoked with an error message when the request fails.

From Java:

Models

Field reference: PensaScanStatus

  • id: Scan ID.

  • scanAreaId: Scan area ID associated with this scan.

  • status: Current overall processing status of the scan (for example, IN_PROGRESS, COMPLETE).

  • fastStatus: Status of earlier pipeline steps, used as a quicker approximation before the final status is available.

  • scanTimestamp: Timestamp when the scan was captured.

  • created: Timestamp when the scan record was created.

  • captureType: Capture type (for example, IMAGE).

  • frameHeight: Frame height in pixels.

  • frameWidth: Frame width in pixels.

  • hasOutOfServiceSegment: Indicates whether the scan includes an out‑of‑service segment.

  • imageCaptureQuality: Capture quality classification.

  • publish: Indicates whether the scan is marked for downstream publishing.

  • scannerId: Identifier of the scanner device.

  • shelfScanPeriodId: Identifier of the shelf scan period.

  • metadata: Nested PensaScanMetadata with additional capture details.

Field reference: PensaScanMetadata

  • applicationId

  • deviceNetworkName

  • deviceNetworkType

  • focalLength

  • frameCaptureRate

  • guid

  • ignoreLateUpload

  • imageHeight

  • imageWidth

  • lensDistortion

  • lensIntrinsicCalibration

  • mobileCaptureCompleted

  • odrStatus

  • pauseList

  • pipelineName

  • sensorPhysicalWidthHeight

  • serverUploadStarted

Example usage (Kotlin)


Fetch on‑demand reports

Method

Use this method to fetch on‑demand analytical reports for a given scan. The primary report currently exposed is the ITEMS_SEEN report, which lists observed products for the scan.

If the SDK is not initialized, the method calls onError("Pensa SDK is not started.").

Parameters

  • scanId: ID of the scan to fetch reports for.

  • projectId: Optional project ID. Set this if you need to disambiguate between multiple projects.

  • onSuccess: Invoked with a PensaOnDemandReport on success.

  • onError: Invoked with an error message on failure.

From Java:

Models

Field reference

  • PensaOnDemandReport.itemsSeen: Container for the ITEMS_SEEN report (if present).

  • PensaOnDemandReportBucket.productList: List of products observed in the scan.

  • PensaOnDemandProduct.brand: Brand name.

  • PensaOnDemandProduct.brandId: Brand identifier.

  • PensaOnDemandProduct.category: Category name.

  • PensaOnDemandProduct.categoryId: Category identifier.

  • PensaOnDemandProduct.manufacturer: Manufacturer name.

  • PensaOnDemandProduct.manufacturerId: Manufacturer identifier.

  • PensaOnDemandProduct.product: Product display name.

  • PensaOnDemandProduct.productId: Product identifier.

  • PensaOnDemandProduct.upc: UPC code for the product.

Example usage (Kotlin)


Fetch product image as Base64

Method

This helper method downloads the default reference image for the given product and returns it as a Base64‑encoded string.

Encodes the image bytes as a Base64 string and passes it to onSuccess.

If the SDK is not initialized, it calls onError("Pensa SDK is not started.").

Parameters

  • context: Android Context used for image loading.

  • productId: ID of the product whose reference image should be fetched.

  • onSuccess: Invoked with a Base64‑encoded string representing the image.

  • onError: Invoked with an error message when the operation fails.

Example: Converting Base64 back to Bitmap

Example Project

For code examples and integration best practices, refer to our GitHub repository.

Last updated

Was this helpful?