barcode: Barcode / QR Code scanner¶
The forge.barcode namespace allows the user to scan a barcode using the devices camera and returns its content
API¶
scan¶
Platforms: iOS, Android
Show a UI that allows the user to scan a barcode and return its value
Example:
forge.barcode.scan(function (value) {
alert("You scanned: "+value);
});
- barcode.scan(success, error)¶
Arguments: - success (function(value)) -- callback to be invoked when no errors occur
- error (function(content)) -- called with details of any error which may occur
scanWithFormat¶
Platforms: iOS, Android
Show a UI that allows the user to scan a barcode and return its value and type.
Example:
forge.barcode.scanWithFormat(function (barcode) {
alert('You scanned a '+barcode.format+': '+barcode.value);
});
- barcode.scanWithFormat(success, error)¶
Arguments: - success (function(barcode)) -- callback to be invoked when no errors occur - barcode will contain format and value keys, where format is the barcode type as returned by ZXing
- error (function(content)) -- called with details of any error which may occur