Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
mmzepedab
Posts: 22
Registered: ‎09-01-2010
My Device: Blackberry 8900

Re: Use Barcode reader With WebWorks

Are you trying it on a real Device?
Regular Contributor
tububerry
Posts: 51
Registered: ‎05-25-2012
My Device: Bold 9930

Re: Use Barcode reader With WebWorks

yes, bold 9930 v7.1
Regular Contributor
tububerry
Posts: 51
Registered: ‎05-25-2012
My Device: Bold 9930

Re: Use Barcode reader With WebWorks

astanley,
I have implemented the barcode app from your link. thanks for that. still working on it with no much success.
can you pls reply to my next question , which was about persisten/sql storage webworks api.
Regular Contributor
tububerry
Posts: 51
Registered: ‎05-25-2012
My Device: Bold 9930

Re: Use Barcode reader With WebWorks

@stanley,

 

I really need help.

 

I am having a hard time understanding this line.

where is the implementation of method scan? i looked up in ext/ folder but i dint get it.

Thanks in advance.

try{ webworks.media.barcode.scan(onCaptured, onError, options); 
Developer
Justam
Posts: 58
Registered: ‎02-14-2011
My Device: Bold 9700

Re: Use Barcode reader With WebWorks

try{ 
webworks.media.barcode.scan(onCaptured, onError, options); 
}catch (err){
alert("Scanner Error: " + err);
}

 

the try{}catch (err){} statement will try the specified code. If any exceptions are thrown it will catch them and store it in a variable called err. We can display the error using alert for example.

 

webworks.media.barcode.scan(onCaptured, onError, options); 

 this is the api invocation argument. onCaptured is a function which the output of the scan will be sent to, onError is the exception which the error will be sent to and options are the flags specified to tell the scanner what to look for etc. see below:

 

optional readwrite Boolean tryHarder; // Default true
optional readwrite String[] format; // Default value ['1D', '2D'] Other Options ['QR_CODE', 'CODE_128', 'CODE_39', 'EAN_13', 'EAN_8', 'ITF', 'UPC_A']

 The default scan method is all, however...I have found if scanning a specific code its best to specify that code in the options flag as I have found it to recognize the data more quickly. 

 

Try this:

 

    // Scans QR codes and Barcodes 5,6,7
    function doScan() {
        // default format = all
        // cheater formats 1d + 2d = all
        var options = {'tryHarder' : true
                      }
        try{
            webworks.media.barcode.scan(onCaptured, onError, options);
        }catch(e){
            alert("Error: " + e);
        }
    }

    function onCaptured(value) {
        alert(value);
    }

    function onError(error) {
        alert('Exception: ' + error.message + ' : ' + error.code);
    }

 Simply call the scan function using doScan(); 

 

<button onClick="doScan();">Scan</button>

 

Regular Contributor
tububerry
Posts: 51
Registered: ‎05-25-2012
My Device: Bold 9930

Re: Use Barcode reader With WebWorks

Thank you.

I did exactly what is written in the html. the feature tag was wrong in config.xml.

But again. the camera is not launching at all. anny idea?

pls help.

Developer
Justam
Posts: 58
Registered: ‎02-14-2011
My Device: Bold 9700

Re: Use Barcode reader With WebWorks

Which device/specific OS version are you trying it on? And, have you tried it on other devices or simulators? 

 

 Place this alert line right below the function brackets like so:

 

function doScan(){
     alert("Scan button clicked");
     
     //Then the rest of your code for the scan function goes below here.
}

 

If the alert pops up then it is accessing your function...if it isn't then there is a good chance there is an error somewhere in your javascript file. 

Regular Contributor
tububerry
Posts: 51
Registered: ‎05-25-2012
My Device: Bold 9930

Re: Use Barcode reader With WebWorks

yes, it is calling the method correctly.

Looks like it is very slow at times when scanning.

 

Will write a blog once i am done with this.

Regular Contributor
tububerry
Posts: 51
Registered: ‎05-25-2012
My Device: Bold 9930

Re: Use Barcode reader With WebWorks

Hey Stanley,

 

I appreicitate your responses.

 

I have developed Barcode reader & Barcode Generater app using the webworks.  It is working fine.

 

Well, I have this strange issue, I ran the same app on 2 different devices:

 

Bold 9930 V7.1 ->  when i start scanning the image is very blurr & shoots in black & white mode only. There is a red horizontal line in the window while the scanning is going on. It takes 5-6 secs to scan when the barcode image is  large & in clear light. or at times it returns a wrong code or nothing.

 

Bold 9700 v6.0 -> Scaning with this is very easy. it opens a square window best option for QR code. THere is no red horizontal line. scnning take just 1-2 sec.

 

1. Is there an auto focus issue on bold 9930. or is there anything i need to fix either in code or settings.

2. is there a way i can switch the backlight on, to help low light scanning?

3. how can i debug the barcode ext? Web inspector doesnt work in 6.0.

4. Any suggestions for IDE for webworks, now that eclipse pluggins are scrapped off.

 

Contributor
mohunt
Posts: 31
Registered: ‎08-26-2011
My Device: Torch 9810

Re: Use Barcode reader With WebWorks

[ Edited ]

Hi,

 

I have trying to get the BarCode extension to package properly.  

 

 have configured the barcode extension as so:

 

The library.xml is in C:\Program Files (x86)\Research In Motion\BlackBerry WebWorks SDK 2.3.1.5\ext\webworks.media.barcode

 

The UI directory and java files are in C:\Program Files (x86)\Research In Motion\BlackBerry WebWorks SDK 2.3.1.5\ext\webworks.media.barcode\webworks\media\barcode

 

The app config.xml looks like this:

 

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0.0">
<name>Solider Barcode App</name>
<description>DemoBarCode demonstrates using native barcode libraries within BlackBerry Application.</description>
<feature id="webworks.media.barcode"/>
<feature id="blackberry.app" required="true" version="1.0.0.0"/>
<feature id="blackberry.app.event" required="true" version="1.0.0.0"/>
<feature id="blackberry.find" required="true" version="1.0.0.0"/>
<feature id="blackberry.identity" required="true" version="1.0.0.0"/>
<feature id="blackberry.identity.phone" required="true" version="1.0.0.0"/>
<feature id="blackberry.invoke" required="true" version="1.0.0.0"/>
<feature id="blackberry.message" required="true" version="1.0.0.0"/>
<feature id="blackberry.system" required="true" version="1.0.0.0"/>
<feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
<feature id="blackberry.ui.menu" required="true" version="1.0.0.0"/>
<feature id="blackberry.utils" required="true" version="1.0.0.0"/>
<feature id="blackberry.invoke.BrowserArguments" required="true" version="1.0.0.0"/>
<feature id="blackberry.invoke.MessageArguments" required="true" version="1.0.0.0"/>
<access subdomains="true" uri="*"/>
<icon rim:hover="false" src="images/icon.png"/>
<content src="index.htm"/>
</widget>

 

When I try to package this I get the following error:

 

C:\Program Files (x86)\Research In Motion\BlackBerry WebWorks SDK 2.3.1.5>bbwp C:\UID\SMBA\SoldierBarcodeAppTOSIGN.zip -o C:\UID\SMBA\output
[INFO] Parsing command line options
[INFO] Parsing bbwp.properties
[INFO] Validating application archive
[INFO] Parsing config.xml
[WARNING] Failed to find the <author> element
[INFO] Populating application source
[Fatal Error] library.xml:16:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[ERROR] Feature cannot be found in any extension(webworks.media.barcode)

 

Help!