Scan and Pair

This sample application will show how the Scan and Pair API can be used to pair two bluetooth devices programmatically.

Download Source

Product

EMDK For Android - 6.6

Devices

MC18KK MC32N0JB MC40JB MC40KK MC67JB MC92KK TC55JB TC55KK TC70KK TC75KK

Overview

This sample application will show how the Scan and Pair API can be used to pair two bluetooth devices programmatically.

Prerequisites

For this sample, you will need two Android Bluetooth devices, one must be an EMDK for Android supported device. You will also need a barcode that contains the Bluetooth MAC address of the remote bluetooth device that we will be pairing with(The one not running the EMDK app).

Note: Although this sample may work with previous versions of the EMDK, it is advised to update the EMDK runtime on your device before loading this sample.

Requirements

Android API 19 must be installed via the SDK Manager before attempting to load this sample.

Loading the Sample Application

The following guide will walk you through setting up the EMDK samples in your IDE.

Using This Sample

  1. When the application starts it should look like the following. Leave the Always Scan and Hard Trigger check boxes selected, and insure the ScanData Type spinner is set to MAC ADDRESS.

    img

  2. Press the Pair button. The Status label will update, stating that the Scan and Pair process has started, and then prompt the user to press the hard scan trigger.

    img

  3. Now place the Pairing Barcode in view of the devices scan window, and then press the devices Hard Scan Trigger. The Scan and Pair sample app will retrieve MAC address from the barcode and place it in the Bluetooth Address field, then it will initiate the pairing and connection process. Press Pair in the Pairing Request dialog, to complete the pairing process. After pairing is complete, the status label will display "Bluetooth device is paired successfully".

    img