Summary: Nested Classes | Constants | Inherited Constants | Fields | Methods | Inherited Methods | [Expand All]
public class

# Barcode

extends Object
implements SafeParcelable

java.lang.Object
↳ | com.google.android.gms.vision.barcode.Barcode

## Class Overview

Barcode represents a single recognized barcode and its value.

The barcode's raw, unmodified, and uninterpreted content is returned in the `rawValue` field, while the barcode type (i.e. its encoding) can be found in the `format` field. Barcodes that contain structured data (commonly done with QR codes) are parsed and iff valid, the `valueFormat` field is set to one of the value format constants (e.g. `GEO`) and the corresponding field is set (e.g. `geoPoint`).

## Summary

Nested Classes
class | Barcode.Address | An address.
class | Barcode.CalendarDateTime | DateTime data type used in calendar events.
class | Barcode.CalendarEvent | A calendar event extracted from QRCode.
class | Barcode.ContactInfo | A person's or organization's business card.
class | Barcode.DriverLicense | A driver license or ID card.
class | Barcode.Email | An email message from a 'MAILTO:' or similar QRCode type.
class | Barcode.GeoPoint | GPS coordinates from a 'GEO:' or similar QRCode type.
class | Barcode.PersonName | A person's name, both formatted version and individual name components.
class | Barcode.Phone | A phone number from a 'TEL:' or similar QRCode type.
class | Barcode.Sms | An sms message from an 'SMS:' or similar QRCode type.
class | Barcode.UrlBookmark | A URL and title from a 'MEBKM:' or similar QRCode type.
class | Barcode.WiFi | A wifi network parameters from a 'WIFI:' or similar QRCode type.

Constants
int | ALL_FORMATS | Barcode format constant representing the union of all supported formats.
int | AZTEC | Barcode format constant for AZTEC.
int | CALENDAR_EVENT | Barcode value format constant for calendar events.
int | CODABAR | Barcode format constant for Codabar.
int | CODE_128 | Barcode format constant for Code 128.
int | CODE_39 | Barcode format constant for Code 39.
int | CODE_93 | Barcode format constant for Code 93.
int | CONTACT_INFO | Barcode value format constant for contact information.
int | DATA_MATRIX | Barcode format constant for Data Matrix.
int | DRIVER_LICENSE | Barcode value format constant for driver's license data.
int | EAN_13 | Barcode format constant for EAN-13.
int | EAN_8 | Barcode format constant for EAN-8.
int | EMAIL | Barcode value format constant for email message details.
int | GEO | Barcode value format constant for geographic coordinates.
int | ISBN | Barcode value format constant for ISBNs.
int | ITF | Barcode format constant for ITF (Interleaved Two-of-Five).
int | PDF417 | Barcode format constant for PDF-417.
int | PHONE | Barcode value format constant for phone numbers.
int | PRODUCT | Barcode value format constant for product codes.
int | QR_CODE | Barcode format constant for QR Code.
int | SMS | Barcode value format constant for SMS details.
int | TEXT | Barcode value format constant for plain text.
int | UPC_A | Barcode format constant for UPC-A.
int | UPC_E | Barcode format constant for UPC-E.
int | URL | Barcode value format constant for URLs/bookmarks.
int | WIFI | Barcode value format constant for WiFi access point details.

[Expand] Inherited Constants
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
String | NULL |
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public Barcode.CalendarEvent | calendarEvent | Parsed calendar event details (set iff `valueFormat` is `CALENDAR_EVENT`).
public Barcode.ContactInfo | contactInfo | Parsed contact details (set iff `valueFormat` is `CONTACT_INFO`).
public Point[] | cornerPoints | 4 corner points in clockwise direction starting with top-left.
public String | displayValue | Barcode value in a user-friendly format.
public Barcode.DriverLicense | driverLicense | Parsed driver's license details (set iff `valueFormat` is `DRIVER_LICENSE`).
public Barcode.Email | email | Parsed email details (set iff `valueFormat` is `EMAIL`).
public int | format | Barcode format, for example `EAN_13`.
public Barcode.GeoPoint | geoPoint | Parsed geo coordinates (set iff `valueFormat` is `GEO`).
public Barcode.Phone | phone | Parsed phone details (set iff `valueFormat` is `PHONE`).
public String | rawValue | Barcode value as it was encoded in the barcode.
public Barcode.Sms | sms | Parsed SMS details (set iff `valueFormat` is `SMS`).
public Barcode.UrlBookmark | url | Parsed URL bookmark details (set iff `valueFormat` is `URL`).
public int | valueFormat | Format of the barcode value.
public Barcode.WiFi | wifi | Parsed WiFi AP details (set iff `valueFormat` is `WIFI`).

Public Methods
Rect | getBoundingBox() Returns the barcode's axis-aligned bounding box.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Constants

#### public static final int ALL_FORMATS

Barcode format constant representing the union of all supported formats. Pass into `setBarcodeFormats(int)` to select formats to recognize. This is also the default setting.

Constant Value: 0 (0x00000000)

#### public static final int AZTEC

Barcode format constant for AZTEC. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 4096 (0x00001000)

#### public static final int CALENDAR_EVENT

Barcode value format constant for calendar events. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 11 (0x0000000b)

#### public static final int CODABAR

Barcode format constant for Codabar. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 8 (0x00000008)

#### public static final int CODE_128

Barcode format constant for Code 128. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 1 (0x00000001)

#### public static final int CODE_39

Barcode format constant for Code 39. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 2 (0x00000002)

#### public static final int CODE_93

Barcode format constant for Code 93. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 4 (0x00000004)

#### public static final int CONTACT_INFO

Barcode value format constant for contact information. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 1 (0x00000001)

#### public static final int DATA_MATRIX

Barcode format constant for Data Matrix. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 16 (0x00000010)

#### public static final int DRIVER_LICENSE

Barcode value format constant for driver's license data. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 12 (0x0000000c)

#### public static final int EAN_13

Barcode format constant for EAN-13. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 32 (0x00000020)

#### public static final int EAN_8

Barcode format constant for EAN-8. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 64 (0x00000040)

#### public static final int EMAIL

Barcode value format constant for email message details. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 2 (0x00000002)

#### public static final int GEO

Barcode value format constant for geographic coordinates. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 10 (0x0000000a)

#### public static final int ISBN

Barcode value format constant for ISBNs. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 3 (0x00000003)

#### public static final int ITF

Barcode format constant for ITF (Interleaved Two-of-Five). Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 128 (0x00000080)

#### public static final int PDF417

Barcode format constant for PDF-417. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 2048 (0x00000800)

#### public static final int PHONE

Barcode value format constant for phone numbers. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 4 (0x00000004)

#### public static final int PRODUCT

Barcode value format constant for product codes. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 5 (0x00000005)

#### public static final int QR_CODE

Barcode format constant for QR Code. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 256 (0x00000100)

#### public static final int SMS

Barcode value format constant for SMS details. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 6 (0x00000006)

#### public static final int TEXT

Barcode value format constant for plain text. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 7 (0x00000007)

#### public static final int UPC_A

Barcode format constant for UPC-A. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 512 (0x00000200)

#### public static final int UPC_E

Barcode format constant for UPC-E. Pass into `setBarcodeFormats(int)` to select formats to recognize, and also specifies a detected Barcode's format via the `format` field.

Constant Value: 1024 (0x00000400)

#### public static final int URL

Barcode value format constant for URLs/bookmarks. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 8 (0x00000008)

#### public static final int WIFI

Barcode value format constant for WiFi access point details. Specifies the format of a Barcode value via the `valueFormat` field.

Constant Value: 9 (0x00000009)

## Fields

#### public Barcode.CalendarEvent calendarEvent

Parsed calendar event details (set iff `valueFormat` is `CALENDAR_EVENT`).

#### public Barcode.ContactInfo contactInfo

Parsed contact details (set iff `valueFormat` is `CONTACT_INFO`).

#### public Point[] cornerPoints

4 corner points in clockwise direction starting with top-left. Due to the possible perspective distortions, this is not necessarily a rectangle.

#### public String displayValue

Barcode value in a user-friendly format. May omit some of the information encoded in the barcode. For example, in the case above the display_value might be 'https://www.google.com'. If valueFormat==TEXT, this field will be equal to rawValue. This value may be multiline, for example, when line breaks are encoded into the original TEXT barcode value. May include the supplement value.

#### public Barcode.DriverLicense driverLicense

Parsed driver's license details (set iff `valueFormat` is `DRIVER_LICENSE`).

#### public Barcode.Email email

Parsed email details (set iff `valueFormat` is `EMAIL`).

#### public int format

Barcode format, for example `EAN_13`. Note that this field may contain values not present in the current set of format constants. When mapping this value to something else, it is advisable to have a default/fallback case.

#### public Barcode.GeoPoint geoPoint

Parsed geo coordinates (set iff `valueFormat` is `GEO`).

#### public Barcode.Phone phone

Parsed phone details (set iff `valueFormat` is `PHONE`).

#### public String rawValue

Barcode value as it was encoded in the barcode. Structured values are not parsed, for example: 'MEBKM:TITLE:Google;URL:https://www.google.com;;' Does not include the supplement value.

#### public Barcode.Sms sms

Parsed SMS details (set iff `valueFormat` is `SMS`).

#### public Barcode.UrlBookmark url

Parsed URL bookmark details (set iff `valueFormat` is `URL`).

#### public int valueFormat

Format of the barcode value. For example, `TEXT`, `PRODUCT`, `URL`, etc. Note that this field may contain values not present in the current set of value format constants. When mapping this value to something else, it is advisable to have a default/fallback case.

#### public Barcode.WiFi wifi

Parsed WiFi AP details (set iff `valueFormat` is `WIFI`).

## Public Methods

#### public Rect getBoundingBox ()

Returns the barcode's axis-aligned bounding box.