discoverReaders

@RequiresPermission(anyOf = ["android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"])
fun discoverReaders(config: DiscoveryConfiguration, discoveryListener: DiscoveryListener, callback: Callback): Cancelable

Begins discovering readers matching the given DiscoveryConfiguration.

When discoverReaders is called, the terminal begins scanning for readers using the settings in the given DiscoveryConfiguration. You must implement DiscoveryListener to handle displaying discovery results to your user and connecting to a selected reader.

The discovery process will stop on its own when the terminal successfully connects to a reader, if the command is canceled, or if an error occurs. If the discovery process completes successfully, or if an error occurs, the Callback will be called to notify that the operation is complete.

To end discovery after a specified time interval, set the timeout property on your DiscoveryConfiguration.

Be sure to either set a timeout, or make it possible to cancel discover in your app's UI.

When discovering readers in our handoff integration mode, discoverReaders will only return a reader if it has been registered. If the current reader has not been registered, discoverReaders will return an empty list of readers.

See https://stripe.com/docs/terminal/readers/connecting.

Return

A Cancelable that allows the operation to be canceled at any time.

Parameters

config

The DiscoveryConfiguration to be used for discovery

discoveryListener

The DiscoveryListener that should be notified whenever a set of Readers is found for connection.

callback

The Callback that should be called after discover has completed.