Getting Started - iOS

Try a sample app. For Xamarin: Capture Xamarin SDK Sample, for Maui: Capture Maui SDK Sample.

Requirements

The Socket Mobile CaptureSDK uses Bluetooth Classic through the External Accessory framework for the barcode scanner products and Bluetooth Low Energy (Bluetooth LE) for the Contactless Reader/Writer products (Such as the Socket Mobile D600 and S550).

For applications that need to work with barcode scanners, make sure the following requirements are met:

  1. Your application needs to be registered in our whitelist before submitting your application to the Apple Store. It will not pass the Apple Store review if this is not done.

  2. Your application’s Info.plist MUST have the key LSApplicationQueriesSchemes (Queried URL Schemes) with a new item: sktcompanion (in lower case).

    <key>LSApplicationQueriesSchemes</key>
    <array>
    <string>sktcompanion</string>
    </array>
    
  3. Your application’s Info.plist MUST have the key NSCameraUsageDescription with a string value explaining to the user how the app uses the camera for camera scanning purpose.

    <key>NSCameraUsageDescription</key>
    <string>Using the device camera to scan a barcode</string>
    
  4. Your application must have the string com.socketmobile.chs in the Supported External Protocol setting.

    <key>UISupportedExternalAccessoryProtocols</key>
    <array>
    <string>com.socketmobile.chs</string>
    </array>
    
  5. Your application’s Info.plist MUST have the NSBluetoothAlwaysUsageDescription key with a string value explaining to the user how the app uses this data. This is an iOS/Apple requirement for applications that use the CoreBluetooth framework. Without it, your application will crash with a message in the Xcode console explaining that you must add the description key. Additionally, if your application has a deployment target earlier than iOS 13.0, you will need to add NSBluetoothPeripheralUsageDescription along with the NSBluetoothAlwaysUsageDescription. More information can be found here in the official Apple Documentation

    <key>NSBluetoothPeripheralUsageDescription</key>
    <string>Bluetooth required for connecting to a barcode scanner</string>
    <key>NSBluetoothAlwaysUsageDescription</key>
    <string>Bluetooth is required for connecting to a barcode scanner</string>
    
  6. Your application’s Info.plist MUST have the key CFBundleAllowMixedLocalizations (Localized resources can be mixed) to YES.

    <key>CFBundleAllowMixedLocalizations</key>
    <true/>
    
  7. An application using the Socket CaptureSDK needs to be registered in order to retrieve an AppKey that is required by the Capture API. You can register for an app key here. Note you will have to log in to create an App Key.

SDK Installation

The SDK is released as a NuGet package named SocketMobile.Capture. The NuGet package lies in the public NuGet Manager.

The CaptureSDK NuGet depends on JSON NuGet from Newtonsoft that will get installed as well.

Configure and Pair Socket Mobile Devices

The scanner can be configured and paired with Add A Reader using Socket Mobile Companion app (recommended), which can be downloaded from the App Store.

To pair your scanner in Application Mode without using Companion app, follow the instructions below.

Configuring the Scanner

By default, the factory settings of the Socket Cordless Scanners are set to Basic Mode (keyboard emulation: HID). In order to use the scanner with an application using CaptureSDK, the scanner must be configured in Application Mode (Bluetooth Serial Port Profile: SPP).

The following barcode will configure your scanner into Application Mode:

_images/spp1d.png

Note

This configuration barcode is persistent across power cycling the scanner and needs to be scanned only once. The scanner will stay in that mode until it is reset to its factory defaults, or until the keyboard emulation Basic Mode(HID) barcode is scanned.

Connecting/Pairing the Scanner to the Host

The process of doing the initial pairing of the scanner to a host iOS is very simple. Make sure that there is no previous pairing saved in the host and in the scanner. On the scanner the pairing can be cleared by following these steps:

  • Turn on the scanner

  • Press the power button while pressing the scan button

  • wait for the scanner to turn off

A series of 3 beeps will confirm the pairing information has been deleted. If these 3 beeps are not heard, retry these steps until you hear the 3 beeps.

To connect the scanner to the host, turn it on and either scan a command barcode that contains the Host Bluetooth Address or simply go to the host Bluetooth settings, discover the scanner and pair to it.