ti.barcode
QR and Barcode Scanner
API reference
Compiled from
- 7.0.0Android
Modules.Barcode
Extends Titanium.Module
Add-on Barcode module
System Requirements
- Titanium SDK 5.5.1+
- Camera Permissions set in your tiapp.xml:
<ti:app>
<!-- ... -->
<ios>
<plist>
<dict>
<key>NSCameraUsageDescription</key>
[string](api:Global.String)We need permission to access your device camera.</string>
</dict>
</plist>
</ios>
<!-- ... -->
</ti:app>
Properties 37
Whether or not to display helpful instructions or a changelog when the app is updated.
Default: true
Whether or not to allow the built-in ZXing menu to display.
Default: true
Deprecated since 2.0.0, removed in 2.0.0
Value that indicates if the barcode capture should analyze captured images in either portrait or landscape device orientation. (Warning: Analyzing both the captured image and the rotated version(s) of the image will increase the processing time of the capture.)
- true: Captured images will be analyzed in both portrait and landscape orientation.
- false [default]: Captured images will be analyzed using only the current device orientation.
Default: false
Used in the success event to specify the assumed content type of the barcode.
Used in the success event to specify the assumed content type of the barcode.
Used in the success event to specify the assumed content type of the barcode.
Whether or not copy the result to the clipboard
Default: false
Controls the message that is displayed to the end user when they are capturing a barcode.
Used in the success event to specify the assumed content type of the barcode.
Deprecated since 5.0.0
Deprecated since 5.0.0
Deprecated since 5.0.0
Used in the success event to specify the assumed content type of the barcode.
Used in the success event to specify the assumed content type of the barcode.
Used in the success event to specify the assumed content type of the barcode.
Used in the success event to specify the assumed content type of the barcode.
Used in the success event to specify the assumed content type of the barcode.
Used in the success event to specify the assumed content type of the barcode.
Controls whether or not the front camera on the device will be used to capture barcodes. On Android, this requires API level 9 (Android OS 2.3) or higher. If no front camera is available, this will gracefully fall back to utilize whatever camera is available.
Default: false
Whether or not to use the LED when scanning barcodes (also known as the flashlight, torch, or some derivation thereof).
Default: false
Used in the success event to specify the assumed content type of the barcode.
Methods 4
cancel
since 3.1.0Cancels and closes the currently open capture window.
Deprecated since 2.0.0
Whether the barcode scanner camera is allowed.
capture
since 3.1.0Brings up the camera and begins the capture sequence for processing a barcode.
| Parameters | Type | Description |
|---|---|---|
| dictionary? | BarcodeCaptureDict | optional 19 fields
|
parse
since 3.1.0Parses a blob image for barcodes.
| Parameters | Type | Description |
|---|---|---|
| dictionary? | BarcodeParseDict | optional 10 fields
|
Events 3
Sent when the scanning process is canceled.
| Event properties | Type | Description |
|---|---|---|
| message | String | The error message |
| code | Number | The activity result code from the scanning activity. Use the result constants defined in the Ti.Android namespace Titanium.Android.RESULT_CANCELED, Titanium.Android.RESULT_FIRST_USER, or Titanium.Android.RESULT_OK |
Sent when an error occurs.
| Event properties | Type | Description |
|---|---|---|
| message | String | The error message |
| code | Number | The activity result code from the scanning activity. Use the result constants defined in the Ti.Android namespace Titanium.Android.RESULT_CANCELED, Titanium.Android.RESULT_FIRST_USER, or Titanium.Android.RESULT_OK |
Fired upon a successful barcode scan.
| Event properties | Type | Description |
|---|---|---|
| format | String | Number | The format of the barcode. Reported with a value of one of the Modules.Barcode.FORMAT_* constant if matching a known format. Otehrwise, may report a string value. |
| result | String | The raw contents of the barcode |
| code | Number | The activity result code from the scanning activity. Use the result constants defined in the Ti.Android namespace Titanium.Android.RESULT_CANCELED, Titanium.Android.RESULT_FIRST_USER, or Titanium.Android.RESULT_OK |
| contentType | Number | The type of barcode content. Use the constants defined in this module to determine which. |
| data | Object | The parsed fields associated with the contentType. |
| bytes | Titanium.Buffer | The raw byte array contents of the barcode, when available |