discoverReaders
@RequiresPermission(anyOf = ["android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"] )
See also
Returns the discovered readers as a Flow of List<Reader>. The flow will emit updates as readers are discovered. The flow will complete when the discovery operation completes or is cancelled. The underlying discovery operation can be cancelled by cancelling the coroutine that is collecting the flow. Example usage:
val job = coroutineScope.launch {
terminal.discoverReaders(discoveryConfiguration)
.catch { e ->
// Handle discovery failure
}
.collect { readers ->
// Handle the list of discovered readers
}
}
}
// Cancelling the job will cancel the ongoing discovery operation
job.cancel()Content copied to clipboard
Note: This function requires location permissions. Make sure to request Manifest.permission.ACCESS_FINE_LOCATION or Manifest.permission.ACCESS_COARSE_LOCATION before calling this function.