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

If you're a Flutter developer, you might be interested in FlutterFire, which includes a plugin for Firebase's ML Vision APIs.

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 stored using one of the supported 2D formats are 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.

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