CaptureSDK 2.0 Migration Guide

This guide helps developers migrate their applications from CaptureSDK 1.x to CaptureSDK 2.0.

Overview

CaptureSDK 2.0 introduces significant changes to how Bluetooth LE devices are discovered and connected. The previous auto-discovery and manual discovery mechanisms have been deprecated in favor of a unified addDevice approach that provides better control and reliability.

Note

Please note that auto-discovery and manual discovery will continue to work with Companion versions 3.5.1 and lower, even when used with CaptureSDK 2.0

Breaking Changes

The following methods and patterns will not work starting with CaptureSDK 2.0:

Auto-Discovery with setFavorite

Status: Will not work starting CaptureSDK 2.0

In CaptureSDK 1.x, developers could use the setFavorite method to automatically discover and connect to Bluetooth LE devices. This approach relied on the Socket Mobile Companion app automatically finding and connecting to Socket Mobile device.

This was done using Property.FAVORITE

Manual Discovery and Connection

Status: Will not work starting CaptureSDK 2.0

In CaptureSDK 1.x, developers could manually scan for Bluetooth LE devices and then connect to them using the manual discovery API. This process involved starting discovery, waiting for device arrival events, and then using the device’s unique ID to establish connections.

This was done using Property.START_DISCOVERY

Migration Path

Use addDevice Method

Status: Approach for CaptureSDK 2.0 and later

All Bluetooth LE device connections should now use the addDevice method. This provides a unified, streamlined, and more reliable approach to device management with better error handling and state management.

Migration Steps

1. Identify setFavorite Usage

Search your codebase for all instances of setFavorite or FAVORITE property usage.

Replace with addDevice calls.

2. Update Manual Discovery Code

Search your codebase for all instances of startDiscovery or START_DISCOVERY property usage.

Replace with addDevice calls.

The migration to addDevice simplifies device management while providing better control and reliability. All applications should migrate to this new approach before upgrading to CaptureSDK 2.0.