Barcode Scanning

With ML Kit's barcode scanning API, you can read data encoded using most standard barcode formats. Barcode scanning happens on the device, and doesn't require a network connection.

Barcodes are a convenient way to pass information from the real world to your app. In particular, when using 2D formats such as QR code, you can encode structured data such as contact information or WiFi network credentials. Because ML Kit can automatically recognize and parse this data, your app can respond intelligently when a user scans a barcode.

iOS Android

Key capabilities

Reads most standard formats
  • Linear formats: Codabar, Code 39, Code 93, Code 128, EAN-8, EAN-13, ITF, UPC-A, UPC-E
  • 2D formats: Aztec, Data Matrix, PDF417, QR Code
Automatic format detection
Scan for all supported barcode formats at once without having to specify the format you're looking for, or boost scanning speed by restricting the detector to only the formats you're interested in.
Extracts structured data
Structured data that's stored using one of the supported 2D formats is automatically parsed. Supported information types include URLs, contact information, calendar events, email addresses, phone numbers, SMS message prompts, ISBNs, WiFi connection information, geographic location, and AAMVA-standard driver information.
Works with any orientation
Barcodes are recognized and scanned regardless of their orientation: right-side-up, upside-down, or sideways.
Runs on the device
Barcode scanning is performed completely on the device, and doesn't require a network connection.

Note that this API does not recognize barcodes in these forms:

  • 1D Barcodes with only one character
  • Barcodes in ITF format with fewer than six characters
  • Barcodes encoded with FNC2, FNC3 or FNC4
  • QR codes generated in the ECI mode

Example results

Corners (49,125), (172,125), (172,160), (49,160)
Raw value 2404105001722
Corners (87,87) (612,87) (612,612) (87,612)
Raw value WIFI:S:SB1Guest;P:12345;T:WEP;;
WiFi information
Password 12345
Type WEP