QR Code Generation Implementation in Mobile App

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
QR Code Generation Implementation in Mobile App
Simple
~1 business day
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing QR Code Generation in Mobile Apps

QR code generation via built-in platform means without third-party libraries. iOS—CIFilter, Android—ZXing or ML Kit. Complexity not in generation, but customization: logo in center, branded colors, rounded module corners—requires manual CoreGraphics or Android Canvas work.

iOS: CIFilter and Customization

Basic generation via CoreImage:

func generateQRCode(from string: String) -> UIImage? {
    guard let data = string.data(using: .utf8),
          let filter = CIFilter(name: "CIQRCodeGenerator") else { return nil }

    filter.setValue(data, forKey: "inputMessage")
    filter.setValue("H", forKey: "inputCorrectionLevel") // H = 30% correction—needed with logo in center

    guard let ciImage = filter.outputImage else { return nil }

    // Scale without blur—via transform, not UIImage(ciImage:) with resize
    let scale = 10.0
    let scaledImage = ciImage.transformed(by: CGAffineTransform(scaleX: scale, y: scale))

    let context = CIContext()
    guard let cgImage = context.createCGImage(scaledImage, from: scaledImage.extent) else { return nil }
    return UIImage(cgImage: cgImage)
}

CIQRCodeGenerator always generates black-white. For color—replace white background and black modules via CIFalseColor filter, or draw over via UIGraphicsImageRenderer.

Logo in center. Correction level H (30%) allows covering 30% area without readability loss. Logo ~25% of QR size works reliably. Overlaid via UIGraphicsImageRenderer:

func addLogo(_ logo: UIImage, to qrImage: UIImage) -> UIImage {
    let renderer = UIGraphicsImageRenderer(size: qrImage.size)
    return renderer.image { _ in
        qrImage.draw(in: CGRect(origin: .zero, size: qrImage.size))
        let logoSize = CGSize(width: qrImage.size.width * 0.25, height: qrImage.size.height * 0.25)
        let logoOrigin = CGPoint(
            x: (qrImage.size.width - logoSize.width) / 2,
            y: (qrImage.size.height - logoSize.height) / 2
        )
        logo.draw(in: CGRect(origin: logoOrigin, size: logoSize))
    }
}

Rounded modules and dot style—CIFilter can't. Parse QR bit matrix and draw each module manually via UIBezierPath. QRCode library (Swift Package) does this with extensive customization options.

Android: ZXing and ML Kit

ZXing—de facto standard for QR on Android:

import com.google.zxing.BarcodeFormat
import com.google.zxing.qrcode.QRCodeWriter

fun generateQRCode(content: String, size: Int): Bitmap {
    val writer = QRCodeWriter()
    val bitMatrix = writer.encode(content, BarcodeFormat.QR_CODE, size, size)

    val bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.RGB_565)
    for (x in 0 until size) {
        for (y in 0 until size) {
            bitmap.setPixel(x, y, if (bitMatrix[x, y]) Color.BLACK else Color.WHITE)
        }
    }
    return bitmap
}

For custom colors—replace Color.BLACK / Color.WHITE. For logo—overlay via Canvas:

fun addLogoToBitmap(qrBitmap: Bitmap, logo: Bitmap): Bitmap {
    val result = qrBitmap.copy(Bitmap.Config.ARGB_8888, true)
    val canvas = Canvas(result)
    val logoSize = qrBitmap.width / 4
    val left = (qrBitmap.width - logoSize) / 2f
    val top = (qrBitmap.height - logoSize) / 2f
    val scaledLogo = Bitmap.createScaledBitmap(logo, logoSize, logoSize, true)
    canvas.drawBitmap(scaledLogo, left, top, null)
    return result
}

ML Kit Barcode Scanning—Google library for not just QR, but EAN, Code 128, Data Matrix. Not for generation (scan only), but often needed nearby—show QR and immediately scan others.

Dynamic QR and UTM Tags

Fixed-URL QR—static. QR leading to redirect service (short link, changeable without QR regen)—dynamic. For marketing: each QR unique, contains UTM tags, click analytics. Generation on server via library (python-qrcode, qrcode npm) with PNG save to CDN.

Mobile client just displays ready PNG or <img> tag via WebView.

Save and Share

Save to gallery: iOS—UIImageWriteToSavedPhotosAlbum or PHPhotoLibrary.shared().performChanges. Requires NSPhotoLibraryAddUsageDescription. Android 10+: MediaStore.Images.Media.insertImage via ContentResolver, no WRITE_EXTERNAL_STORAGE permission.

Share: UIActivityViewController with UIImage (iOS), Intent.ACTION_SEND with URI via FileProvider (Android).

1 working day for basic generation. Custom module style, logo, branding—2–3 days. Cost calculated individually.