...
- argument #1: function to be called when the scan succeeds.
- argument #2: function to be called when cancel button is pressed
- argument #3: name of the plugin, which is "ScanditSDK"
- argument #4: name of the function of the plugin to be called, which is "scan"
- argument #5: an array where the first item is the Scandit SDK app key (available from your Scandit SDK web account) and the second item is a dictionary with customization options (listed in ScanditSDK.java)
To grab the value of the scanned barcode, simply use result. Result is an array which holds information about the scanned barcode.
For example:
Code Block |
---|
var barcode = result[0];
var symbology = result[1];
|
Below is an example call to cordova.exec():
Code Block | ||||
---|---|---|---|---|
| ||||
function scan() {
cordova.exec(success, failure, "ScanditSDK", "scan",
["123456abcdefg",
{"beep": true,
"1DScanning": true,
"2DScanning": true,
"scanningHotspot": "0.5/0.5",
"vibrate": true}]);
}\
|
Scandit for iOS
To begin, you will need to download the Scandit SDK for iOS, as well as the Phonegap Plugin for Scandit SDK for iOS. You must first register with Scandit first. The link for this can be found here: Scandit Options
...
- argument #1: function to be called when the scan succeeds.
- argument #2: function to be called when cancel button is pressed
- argument #3: name of the plugin, which is "ScanditSDK"
- argument #4: name of the function of the plugin to be called, which is "scan"
- argument #5: an array where the first item is the Scandit SDK app key (available from your Scandit SDK web account) and the second item is a dictionary with customization options (listed in ScanditSDK.java
To grab the value of the scanned barcode, simply use result. Result is a concatenated string which contains information about your scanned barcode, with each piece of information seperated by a "|" character.
An example of how to grab the needed barcode string:
Code Block |
---|
var barcode = "";
var index = result.indexOf("|");
for(var i = index + 1; i < result.length;i++){
barcode += result[i];
}
|
Below is an example call to cordova.exec():
Code Block | ||||
---|---|---|---|---|
| ||||
function scan() { cordova.exec(success, failure, "ScanditSDK", "scan", ["123456abcdefg", {"beep": true, "1DScanning": true, "2DScanning": true, "scanningHotspot": "0.5/0.5", "vibrate": true}]); } |