Skip to main content

Offline Mode

How does the offline mode for Lens work

In Lens's offline mode, users can capture and edit images, benefiting from image enhancement features like perspective adjustment and blurring detection, thanks to machine learning algorithms. Crucially, when operating offline, certain actions such as document processing for data extraction are not executed immediately but are instead methodically queued. This queuing ensures that no document packages (tasks) are lost during offline periods.

What is the expected behavior of Lens during offline mode

During offline mode, Lens efficiently performs several functions. It captures and crops images and uses its local machine learning algorithms for image enhancements. Importantly, Lens is also capable of extracting data from credit cards using these local algorithms, a feature operational even without an internet connection.

In addition, Lens incorporates a queuing system for tasks that cannot be completed offline. For instance, if a task requires online processing and the device is offline, Lens automatically queues this task. These queued tasks are then ready for processing once the device regains internet connectivity, ensuring no task is left unfinished due to a lack of an online connection. This queuing functionality adds a layer of reliability and efficiency to Lens’s offline mode.

What doesn’t work during the offline mode

In offline mode, the only feature that doesn't work in Lens is the extraction of data from documents, except for credit cards, which can be processed offline. To address this, Lens has a queuing system. Any data extraction tasks initiated while offline are automatically queued.

// Get package identifiers from the upload queue

How to handle network status changes (online <-> offline)

Lens likely manages network status changes by queuing tasks when offline. The number of queued tasks can be checked using the veryfiLensClose function (via the 'queue_count' key).

"queue_count": 2,
"status": "close",
"framework-version": "VeryfiLens 2.1.37 #7",
"session_scan_count": 1

Once online, these tasks can either be retried or discarded.

// Retry uploading all packages currently in queue

// Remove all packages from the queue

This indicates that Lens can adapt to network transitions by storing tasks for later processing.

How to initialize/configure Lens when the app is offline

For the first-time initialization of Lens, an online connection is necessary. This is due to the requirement for authenticating credentials and decrypting local algorithms for advanced features. Once initialized, the 'validation_time_window' property dictates how long these credentials remain valid before needing re-validation. If the app is started offline after this period, some functionalities may not be available until re-validation occurs.

How does offline document processing work

Offline document processing in Lens is limited to basic image editing and enhancements. Advanced processing like data extraction will not function offline. If attempted, such operations will encounter an error and the tasks will be queued for processing once an internet connection is reestablished.

"package_id": "jiCIUMgD86mpjQUOCRyO",
"document_type": "receipt",
"status": "fail",
"msg": "No Internet Connection"