Skip to main content

ProGlove documentation

Integration Details and permissions

The Standalone SDK enables direct integration of ProGlove scanners into your Android application. This section describes how to correctly integrate the SDK, manage its lifecycle, and request the necessary runtime permissions.

Integration details

To interact with the Standalone SDK you need to create a PgManager instance. Through its API you can:

  • Connect with or disconnect a ProGlove scanner

  • Monitor connection status

  • Receive scanned barcode data (incl. barcode value and symbology)

  • Send commands (e.g. worker feedback, set screen, block trigger)

  • Receive notifications (trigger unblocked, double trigger events)

Note

Use application context

Always provide the application context when instantiating PgManager to avoid memory leaks.

Keep a single instance in memory

The app must keep a reference to the PgManager in memory to maintain communication with the scanner. If PgManager is cleared by the garbage collector, the BLE connection will be broken.

  • Do not create multiple instances - each would attempt to open its own BLE connection.

  • Best practice: Keep a single instance of PgManager in a foreground service.

Release resources properly before clearing the PgManager instance

When your app no longer requires the PgManager instance:

  1. Unsubscribe all listeners before releasing the PgManager.

  2. Call PgManager.die() before releasing the instance.

This ensures resources are freed and connections are closed cleanly.

Runtime permissions

Your application is responsible for requesting the required runtime permissions. The following permissions are necessary for the Standalone SDK to function correctly:

Permission

Android version

Purpose

Notes

android.permission.BLUETOOTH_ADMIN

API 30 and lower

Bluetooth management

Required on Android 11 and lower

android.permission.BLUETOOTH

API 30 and lower

Bluetooth usage

Required on Android 11 and lower

android.permission.BLUETOOTH_SCAN

API 31 and higher

BLE scanning

Required on Android 12 and higher

android.permission.BLUETOOTH_CONNECT

All versions

BLE connection

Always required

android.permission.BLUETOOTH_ADVERTISE

All versions

BLE advertising

Always required

android.permission.ACCESS_FINE_LOCATION

All versions

Required for Bluetooth usage and reconnection in background

Note: Location is not tracked by the SDK

Notice

Note: Location permission is only used for Bluetooth functionality and background reconnections. The Standalone SDK does not collect or track location data.

Connection process

Before starting the connection, ensure that:

  • All required permissions are granted.

  • Bluetooth is enabled on the device

To initiate pairing call PgManager.startPairing().

If all preconditions are met, the SDK generates a random advertising name and starts BLE scanning for a scanner advertising with that name.

The scanner must scan a special PEP QR code to begin advertising. This QR code encodes a command containing the embedded advertising name, which puts the scanner into advertising mode using that specific name.

To establish the connection, the scanner must scan the PEP QR code containing the advertising name generated by the SDK. This QR code is provided as a Bitmap argument in the IScannerConnectionState.onScannerSearching(pepBarcode) callback. To receive this and other connection state callbacks, subscribe using PgManager.subscribeToScannerConnectionStatus(callback).

Note

Note: When PgManager.startPairing() is called, the SDK automatically disconnects any ongoing BLE connection with a scanner before starting a new connection process.

Command queue and PgCommand wrapper

The Standalone SDK sends commands to the scanner synchronously — one by one, on a background thread. Execution time varies depending on the command type — for example, a screen update command may take longer than a simple feedback trigger.

While a command is being executed, the SDK can queue up to five additional commands. If this queue limit is reached, new commands are rejected, and the callback will return PgError.CommandQueueLimitReached.

In some workflows, you may need to send a high-priority command that should execute immediately — for example, blocking the trigger without waiting for other queued commands. To achieve this, use the replaceQueue flag when creating your command.

When a command is flagged with replaceQueue = true, the SDK automatically clears all pending commands from the queue and inserts the flagged command as the next one to execute. Commands removed from the queue will not be executed, and the SDK will return PgError.CanceledByCommandQueueReplace for each of them. Once a command is executing, it cannot be interrupted — except by disconnecting the scanner.

To create a high-priority command with queue replacement enabled:

val pgCommandParams = PgCommandParams(replaceQueue = true)
val urgentCommand = PgCommand(successFeedback, pgCommandParams)
pgManager.triggerFeedback(urgentCommand, this)