pairReader

Begins scanning for a new Bluetooth reader. The scan will terminate after a timeout, or after one new reader is identified, whether that reader is paired successfully or not.

See setReaderChangedCallback to receive notification about newly discovered readers, as well as about other changes to reader state and availability. See isPairingInProgress to check if it returns false before calling pairReader; doing otherwise might result in error.

It is invalid to attempt to pair a reader while still attempting to pair from a previous call. The original pairing attempt will continue unaffected but the second call will immediately trigger the pairing callback with PairingErrorCode.USAGE_ERROR. When the first pairing effort completes the callbacks will be made again, with the status of that perhaps-successful attempt.

Return

a PairingHandle which can be used for interaction with the just started reader pairing (e.g. canceling it)

Parameters

callback

to be called when pairing completes. This callback is called once per call to pairReader, run on the application UI thread, and contains the result of that pairing: reader discovered, timeout, cancellation, or whatever error condition was found.

If pairing completes successfully, the Callback's success value is a boolean for whether a card reader paired or not. If true, a card reader was found, reported to the callback provided via setReaderChangedCallback, and added to the list of readers accessed via ReaderManager.getReaders. A successful result with false indicates a canceled pairing attempt. In case of failure, error description would contain a PairingErrorCode.