This class is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Represents a single recognized barcode and its value.
The barcode's raw, unmodified, and uninterpreted content is returned in the
getRawValue()
field, while the barcode type (i.e. its encoding) can be found in
the
getFormat()
field.
Nested Class Summary
class | FirebaseVisionBarcode.Address | An address. | |
@interface | FirebaseVisionBarcode.BarcodeFormat | Barcode format constants - enumeration of supported barcode formats. | |
@interface | FirebaseVisionBarcode.BarcodeValueType |
Barcode value type constants - enumeration of supported barcode content value types
Supported types include: |
|
class | FirebaseVisionBarcode.CalendarDateTime | DateTime data type used in calendar events. | |
class | FirebaseVisionBarcode.CalendarEvent | A calendar event extracted from QRCode. | |
class | FirebaseVisionBarcode.ContactInfo | A person's or organization's business card. | |
class | FirebaseVisionBarcode.DriverLicense | A driver license or ID card. | |
class | FirebaseVisionBarcode.Email | An email message from a 'MAILTO:' or similar QRCode type. | |
class | FirebaseVisionBarcode.GeoPoint | GPS coordinates from a 'GEO:' or similar QRCode type. | |
class | FirebaseVisionBarcode.PersonName | A person's name, both formatted version and individual name components. | |
class | FirebaseVisionBarcode.Phone | Phone number info. | |
class | FirebaseVisionBarcode.Sms | A sms message from a 'SMS:' or similar QRCode type. | |
class | FirebaseVisionBarcode.UrlBookmark | A URL and title from a 'MEBKM:' or similar QRCode type. | |
class | FirebaseVisionBarcode.WiFi | A wifi network parameters from a 'WIFI:' or similar QRCode type. |
Constant Summary
int | FORMAT_ALL_FORMATS | Barcode format constant representing the union of all supported formats. |
int | FORMAT_AZTEC | Barcode format constant for AZTEC. |
int | FORMAT_CODABAR | Barcode format constant for Codabar. |
int | FORMAT_CODE_128 | Barcode format constant for Code 128. |
int | FORMAT_CODE_39 | Barcode format constant for Code 39. |
int | FORMAT_CODE_93 | Barcode format constant for Code 93. |
int | FORMAT_DATA_MATRIX | Barcode format constant for Data Matrix. |
int | FORMAT_EAN_13 | Barcode format constant for EAN-13. |
int | FORMAT_EAN_8 | Barcode format constant for EAN-8. |
int | FORMAT_ITF | Barcode format constant for ITF (Interleaved Two-of-Five). |
int | FORMAT_PDF417 | Barcode format constant for PDF-417. |
int | FORMAT_QR_CODE | Barcode format constant for QR Code. |
int | FORMAT_UNKNOWN | Barcode format unknown to the current SDK. |
int | FORMAT_UPC_A | Barcode format constant for UPC-A. |
int | FORMAT_UPC_E | Barcode format constant for UPC-E. |
int | TYPE_CALENDAR_EVENT | Barcode value type constant for calendar events. |
int | TYPE_CONTACT_INFO | Barcode value type constant for contact information. |
int | TYPE_DRIVER_LICENSE | Barcode value type constant for driver's license data. |
int | TYPE_EMAIL | Barcode value type constant for email message details. |
int | TYPE_GEO | Barcode value type constant for geographic coordinates. |
int | TYPE_ISBN | Barcode value type constant for ISBNs. |
int | TYPE_PHONE | Barcode value type constant for phone numbers. |
int | TYPE_PRODUCT | Barcode value type constant for product codes. |
int | TYPE_SMS | Barcode value type constant for SMS details. |
int | TYPE_TEXT | Barcode value type constant for plain text. |
int | TYPE_UNKNOWN | Barcode value type unknown, which indicates the current version of SDK cannot recognize the structure of the barcode. |
int | TYPE_URL | Barcode value type constant for URLs/bookmarks. |
int | TYPE_WIFI | Barcode value type constant for WiFi access point details. |
Public Method Summary
Rect |
getBoundingBox()
Gets the bounding rectangle of the detected barcode.
|
FirebaseVisionBarcode.CalendarEvent |
getCalendarEvent()
Gets parsed calendar event details (set iff
getValueType() is
TYPE_CALENDAR_EVENT ).
|
FirebaseVisionBarcode.ContactInfo |
getContactInfo()
Gets parsed contact details (set iff
getValueType() is
TYPE_CONTACT_INFO ).
|
Point[] |
getCornerPoints()
Returns four corner points in clockwise direction starting with top-left.
|
String |
getDisplayValue()
Returns barcode value in a user-friendly format.
|
FirebaseVisionBarcode.DriverLicense |
getDriverLicense()
Gets parsed driver's license details (set iff
getValueType() is
TYPE_DRIVER_LICENSE ).
|
FirebaseVisionBarcode.Email |
getEmail()
Gets parsed email details (set iff
getValueType() is
TYPE_EMAIL ).
|
int |
getFormat()
Returns barcode format, for example
FORMAT_EAN_13 .
|
FirebaseVisionBarcode.GeoPoint |
getGeoPoint()
Gets parsed geo coordinates (set iff
getValueType() is
TYPE_GEO ).
|
FirebaseVisionBarcode.Phone |
getPhone()
Gets parsed phone details (set iff
getValueType() is
TYPE_PHONE ).
|
byte[] |
getRawBytes()
Returns raw bytes as it was encoded in the barcode.
|
String |
getRawValue()
Returns barcode value as it was encoded in the barcode.
|
FirebaseVisionBarcode.Sms |
getSms()
Gets parsed SMS details (set iff
getValueType() is
TYPE_SMS ).
|
FirebaseVisionBarcode.UrlBookmark |
getUrl()
Gets parsed URL bookmark details (set iff
getValueType() is
TYPE_URL ).
|
int |
getValueType()
Returns format type of the barcode value.
|
FirebaseVisionBarcode.WiFi |
getWifi()
Gets parsed WiFi AP details (set iff
getValueType() is
TYPE_WIFI ).
|
Inherited Method Summary
Constants
public static final int FORMAT_ALL_FORMATS
Barcode format constant representing the union of all supported formats. Pass into
setBarcodeFormats(int, int...)
to select formats to recognize. This is also
the default setting.
public static final int FORMAT_AZTEC
Barcode format constant for AZTEC.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_CODABAR
Barcode format constant for Codabar.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_CODE_128
Barcode format constant for Code 128.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_CODE_39
Barcode format constant for Code 39.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_CODE_93
Barcode format constant for Code 93.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_DATA_MATRIX
Barcode format constant for Data Matrix.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_EAN_13
Barcode format constant for EAN-13.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_EAN_8
Barcode format constant for EAN-8.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_ITF
Barcode format constant for ITF (Interleaved Two-of-Five).
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_PDF417
Barcode format constant for PDF-417.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_QR_CODE
Barcode format constant for QR Code.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_UNKNOWN
Barcode format unknown to the current SDK.
public static final int FORMAT_UPC_A
Barcode format constant for UPC-A.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int FORMAT_UPC_E
Barcode format constant for UPC-E.
Pass into
setBarcodeFormats(int, int...)
to select formats to recognize, and also
specifies a detected Barcode's format via the
getFormat()
field.
public static final int TYPE_CALENDAR_EVENT
Barcode value type constant for calendar events. Specifies the format of a Barcode
value via the
getValueType()
field.
public static final int TYPE_CONTACT_INFO
Barcode value type constant for contact information. Specifies the format of a
Barcode value via the
getValueType()
field.
public static final int TYPE_DRIVER_LICENSE
Barcode value type constant for driver's license data. Specifies the format of a
Barcode value via the
getValueType()
field.
public static final int TYPE_EMAIL
Barcode value type constant for email message details. Specifies the format of a
Barcode value via the
getValueType()
field.
public static final int TYPE_GEO
Barcode value type constant for geographic coordinates. Specifies the format of a
Barcode value via the
getValueType()
field.
public static final int TYPE_ISBN
Barcode value type constant for ISBNs. Specifies the format of a Barcode value via
the
getValueType()
field.
public static final int TYPE_PHONE
Barcode value type constant for phone numbers. Specifies the format of a Barcode
value via the
getValueType()
field.
public static final int TYPE_PRODUCT
Barcode value type constant for product codes. Specifies the format of a Barcode
value via the
getValueType()
field.
public static final int TYPE_SMS
Barcode value type constant for SMS details. Specifies the format of a Barcode value
via the
getValueType()
field.
public static final int TYPE_TEXT
Barcode value type constant for plain text. Specifies the format of a Barcode value
via the
getValueType()
field.
public static final int TYPE_UNKNOWN
Barcode value type unknown, which indicates the current version of SDK cannot recognize the structure of the barcode. Developers can inspect the raw value instead.
public static final int TYPE_URL
Barcode value type constant for URLs/bookmarks. Specifies the format of a Barcode
value via the
getValueType()
field.
public static final int TYPE_WIFI
Barcode value type constant for WiFi access point details. Specifies the format of a
Barcode value via the
getValueType()
field.
Public Methods
public Rect getBoundingBox ()
Gets the bounding rectangle of the detected barcode.
Returns null if the bounding rectangle can not be determined.
public FirebaseVisionBarcode.CalendarEvent getCalendarEvent ()
Gets parsed calendar event details (set iff
getValueType()
is
TYPE_CALENDAR_EVENT
).
public FirebaseVisionBarcode.ContactInfo getContactInfo ()
Gets parsed contact details (set iff
getValueType()
is
TYPE_CONTACT_INFO
).
public Point[] getCornerPoints ()
Returns four corner points in clockwise direction starting with top-left.
Due to the possible perspective distortions, this is not necessarily a rectangle.
public String getDisplayValue ()
Returns barcode value in a user-friendly format. May omit some of the information
encoded in the barcode. For example, if
getRawValue()
returns
'MEBKM:TITLE:Google;URL://www.google.com;;'
, the display_value might be
'//www.google.com'
. If valueFormat==TEXT, this field will be equal to
getRawValue()
. This value may be multiline, for example, when line breaks
are encoded into the original TEXT barcode value. May include the supplement value.
Returns null
if nothing found.
public FirebaseVisionBarcode.DriverLicense getDriverLicense ()
Gets parsed driver's license details (set iff
getValueType()
is
TYPE_DRIVER_LICENSE
).
public FirebaseVisionBarcode.Email getEmail ()
Gets parsed email details (set iff
getValueType()
is
TYPE_EMAIL
).
public int getFormat ()
Returns barcode format, for example
FORMAT_EAN_13
.
public FirebaseVisionBarcode.GeoPoint getGeoPoint ()
Gets parsed geo coordinates (set iff
getValueType()
is
TYPE_GEO
).
public FirebaseVisionBarcode.Phone getPhone ()
Gets parsed phone details (set iff
getValueType()
is
TYPE_PHONE
).
public byte[] getRawBytes ()
Returns raw bytes as it was encoded in the barcode.
public String getRawValue ()
Returns barcode value as it was encoded in the barcode. Structured values are not
parsed, for example: 'MEBKM:TITLE:Google;URL://www.google.com;;'
.
It's only available when the barcode is encoded in the UTF-8 format, and for
non-UTF8 ones use
getRawBytes()
instead.
public FirebaseVisionBarcode.Sms getSms ()
Gets parsed SMS details (set iff
getValueType()
is
TYPE_SMS
).
public FirebaseVisionBarcode.UrlBookmark getUrl ()
Gets parsed URL bookmark details (set iff
getValueType()
is
TYPE_URL
).
public int getValueType ()
Returns format type of the barcode value.
For example,
TYPE_TEXT
,
TYPE_PRODUCT
,
TYPE_URL
, etc.
If the value structure cannot be parsed,
TYPE_TEXT
will be returned. If the recognized structure type is not defined
in your current version of SDK,
TYPE_UNKNOWN
will be returned.
Note that the built-in parsers only recognize a few popular value structures. For
your specific use case, you might want to directly consume
getRawValue()
and implement your own parsing logic.
public FirebaseVisionBarcode.WiFi getWifi ()
Gets parsed WiFi AP details (set iff
getValueType()
is
TYPE_WIFI
).