Skip to content

QrCodeGenerator

Alexander Zhirkevich edited this page Sep 7, 2022 · 2 revisions

Generator of the QR code image.

interface QrCodeGenerator {

    fun generateQrCode(data: QrData, options: QrOptions) : Bitmap

    suspend fun generateQrCodeSuspend(data: QrData, options: QrOptions) : Bitmap
}

Methods

fun generateQrCode(data: QrData, options: QrOptions) : Bitmap

Generate a QR code bitmap


suspend fun generateQrCodeSuspend(data: QrData, options: QrOptions) : Bitmap

Wrapper for generateQrCode with cancellation support. Always performs with Dispatchers.Default

ThreadPolicy

Number of threads used for code generating. More threads does not mean more performance.

enum class ThreadPolicy {
    SingleThread, DoubleThread, QuadThread
}

Instantiating

Generator can be created using the following function:

fun QrCodeGenerator(
    context: Context,
    threadPolicy: ThreadPolicy = ThreadPolicy.SingleThread
) : QrCodeGenerator
Clone this wiki locally