This getting started guide illustrates the steps required to integrate the Scandit Barcode Scanner module into your Titanium app.
Download the Scandit Barcode Scanner Titanium Module
Choose a plan (e.g., free “Enterprise Trial” or "Community" plan) at http://www.scandit.com/pricing and download the Scandit Barcode Picker module from your account.
It is generally not advised to download the module from the Titanium marketplace as it can cause an "unlicensed module error" for some users. If you do downloaded the Scandit Barcode Scanner module from the TI marketplace, sign up for a free community license at http://www.scandit.com/pricing. There are also other licenses available that include support for enterprise bar codes such as Code39, Code128, Datamatrix etc. If you are interested in those, just sign up for the corresponding license at http://www.scandit.com/pricing. These enterprise licenses come with a different SDK and you need to download the corresponding titanium module from the download section of your Scandit SDK account and add it as described above in step “Install the Scandit SDK module”.
Install the Scandit Barcode Scanner SDK module
- Follow the Appcelerator instructions to add the Scandit Barcode Scanner module to the “modules” directory of your Titanium Studio installation: http://docs.appcelerator.com/platform/latest/#!/guide/Using_a_Module
- Add the Scandit Barcode Scanner module to your tiapp.xml file - either by using the GUI editor or by editing the modules section and adding the following lines:
Start using the scanner module in your app
First you will have to import the module through require().
At this point you need to sign in to your account at http://account.scandit.com to look up your license key (under the "License Key" section) as you now need to set it. You can also set your preferred camera at this point (back or front, back is the default).
Before you create the barcode picker you should check that your app has permission to open the camera. An example of this would look the following way:
Once this is done you can now create the actual view from the module. Make sure that you always initialize it by calling init() before calling any other functions on the view (they will not take effect otherwise).
At this point you can make any necessary customizations like enabling or disabling symbologies etc. Have a look at the scanditsdkView API for all available options. Once all customizing is done you can present the view and at that point you will need to tell it to start scanning as it is not trying to decode barcodes before doing so.
Example code
You can use the following example code as a starting point: