TMT3 PhoneGap Barcode Scanner Update: to use with PhoneGap 1.0.0

906 views
Skip to first unread message

Elizabeth Baldwin

unread,
Sep 19, 2011, 9:28:05 PM9/19/11
to eclipse-plugi...@googlegroups.com
A recent post on the phonegap google group explained how to update the Barcode Scanner plugin to PhoneGap 1.0.0.

I've added those 2 changes to TMT3 tutorial, so you should have no problem using the latest AppLaud with the default PhoneGap version 1.0.0 and the Barcode Scanner PhoneGap Plugin.

The changes from 0.9.x are something PhoneGap / Android plugin developers should be familiar with:

1. Add to res/xml/plugins.xml this line:

<plugin name="BarcodeScanner" value="com.beetight.barcodescanner.BarcodeScanner"/>

2. Don't use the 0.9.5 way of connecting plugin. Delete this line (107) from barcodescanner.js:

PluginManager.addService("BarcodeScanner","com.beetight.barcodescanner.BarcodeScanner");

Will update tutorial when the official plugin is updated. Thanks for you patience.

Libby

trista...@gmail.com

unread,
Sep 20, 2011, 10:58:34 PM9/20/11
to eclipse-plugi...@googlegroups.com
i have a question.

I've done it all and with PhoneGap 1.0.0 and able to run the app. However when i click the Scan QR Code/Encode Text, nothing happens.
Is there something else I need to do? or it will scan when implemented on the phone? Thnx

Elizabeth Baldwin

unread,
Sep 21, 2011, 11:44:48 AM9/21/11
to eclipse-plugi...@googlegroups.com
Are you running on an AVD or real device?

Did you add SD CARD to the AVD, and install ZXing Barcode Scanner? The app should prompt you to install ZXing barcode scanner if it's not there. Recommended to install it manually, not from this app's prompt.

On AVD, Encode Text should show an encoded image, as the text to encode is hard-coded in the example app.

Libby

trista...@gmail.com

unread,
Sep 21, 2011, 11:54:44 AM9/21/11
to eclipse-plugi...@googlegroups.com
ohhh.. im using eclipse avd. I havent yet install Zxing Barcode Scanner, but theres no prompt. Im trying to install it, im following these steps http://cfsearching.blogspot.com/2010/01/how-to-install-zxing-in-eclipse-javase.html 

However i got error in adding the classpaths

Elizabeth Baldwin

unread,
Sep 21, 2011, 12:25:44 PM9/21/11
to eclipse-plugi...@googlegroups.com
I believe what you have referenced is for people that want to
_develop_ ZXing, which is different from the ZXing Barcode
Scanner Android app. Same program, but one is the source
and one is an Android app.

I've been trying to reproduce your environment here, but my
AVD has been flaky so far and something in the browser
times out.

You might try: Install "Android Market" app on AVD, OR open
in browser: http://market.android.com, and then:

Find "ZXing Barcode Scanner" app and install - it's free.

Make sure you have an SD Card configured in the AVD.

Unfortunately the barcode scanner is notoriously difficult to
use in AVD. Let us know what works best for you. Thanks!

Libby

trista...@gmail.com

unread,
Sep 21, 2011, 1:48:02 PM9/21/11
to eclipse-plugi...@googlegroups.com
My objective is to develop an app that could scan QR Codes and modify it.
Im trying to use this application(phonegap), eclipse and zxing to have an open
source application that i can edit and be able to study.

Ive been able to run phonegap(w/o zxing) and zxing separately,
in different projects. Now im trying to run them together.  

Its a thesis project. Thank you very much 

kim lacson

unread,
Sep 22, 2011, 3:20:19 AM9/22/11
to Eclipse Plugin for PhoneGap
Ive been able to install zxing barcode reader on my project AVD
along with the phonegap QR Code scanner.
When I run the zxing it seems to run okay
However when I run the phonge gap, Scan QR Code
nothing happens.

Is there still something to connect the two or would it run if I
implement it in a real android phone?

Thnx

Elizabeth Baldwin

unread,
Sep 22, 2011, 12:33:44 PM9/22/11
to eclipse-plugi...@googlegroups.com
Hello. Thanks for sharing this information.

When you run ZXing app on the AVD, are you able to
- scan? (real or simulated)
- encode? (sounds like "yes", just confirming)

With the phonegap version, can you encode? Or is
scanning the only thing not working?

Do you see anything in DDMS/log output? Can you
verify the code with alerts, etc?

The sample app in the tutorial has always worked on
real devices - scanning and encoding.

Cheers,
Libby

saurabh...@gmail.com

unread,
Sep 23, 2011, 6:41:27 AM9/23/11
to eclipse-plugi...@googlegroups.com
When i click the "Scan QR Code" button, camera launches with red scanning line, but scanning is not working?
It just launches the camera, and nothing really happens ?

Elizabeth Baldwin

unread,
Sep 23, 2011, 11:43:39 AM9/23/11
to eclipse-plugi...@googlegroups.com
Actually, that is how the camera lets you know it's ready
to scan. Aim it at a code, like sample one on the tutorial
page, and it will scan after locking on to the three corners.

Viktor Niniadis

unread,
Oct 19, 2011, 10:49:12 AM10/19/11
to Eclipse Plugin for PhoneGap


Thanks for tutuorial.Its works great!!!
I try to make some app that search artikels in my shop
My question is:
How i can use this code to put result from scanner to search form?

Elizabeth Baldwin

unread,
Oct 19, 2011, 12:55:49 PM10/19/11
to eclipse-plugi...@googlegroups.com
Hi Viktor.

I'm not completely sure about your question. It sounds like your
app scans product bar codes, then searches your shop's database
to find that product. If this is the case - the result of the scan
(the tmt just put's that string into an alert() ) can go into your search
form.

Does that help? Or what is an example of your scanned data?

Cheers,
Libby

Viktor Niniadis

unread,
Oct 27, 2011, 4:57:30 AM10/27/11
to eclipse-plugi...@googlegroups.com


Hi Libby thanks for your response.

In  our shop vitrine we have no prices for products but QR codes because the prices changes almost every day.Here is sample for our price stand.I try to make some app that scans the qr code link and open it in some webview component.

Regards.

Viktor.


Elizabeth Baldwin

unread,
Oct 27, 2011, 3:52:30 PM10/27/11
to eclipse-plugi...@googlegroups.com
Very cool.  I'm sent you an email off-line about your example.

I'm wondering if using the childbrowser plugin to display the page
at that url is what you're looking for. The Child browser is here
and very well documented. Basically add it the same way as
barcode scanner - see README.md for instructions.

Instead of displaying url in alert, put url in childbrowser's
showWebPage() method.

He has child browser for iPhone and maybe other platforms, too.

Libby

greatarjun

unread,
Dec 9, 2011, 3:11:54 AM12/9/11
to eclipse-plugi...@googlegroups.com
Hi mee tooo
when i click the Scan QR Code/Encode Text, nothing happens.
plz help meeeeeeeeeeee
arju...@gmail.com

he...@ashleyjwheat.co.uk

unread,
Dec 25, 2011, 11:36:56 PM12/25/11
to eclipse-plugi...@googlegroups.com
Hi, 

I'm trying to implement the same idea in my application, automatically opening a webpage when a QR code is scanned using the showWebPage() method in childbrowser on the iPhone.

All is well and good and my code scans, the console tells me that the webpage is opening, but my app does nothing. Any idea?

Elizabeth Baldwin

unread,
Dec 26, 2011, 12:45:39 PM12/26/11
to eclipse-plugi...@googlegroups.com
Have you tried hard-coding a url to verify your childbrowser plugin
code is working?  Like a small app w/only childbrowser, that just opens
a location using showWebPage. If the scanner code seems to work,
I'd target the childbrowser plugin part.

Elizabeth Baldwin

unread,
Dec 26, 2011, 2:41:09 PM12/26/11
to eclipse-plugi...@googlegroups.com
Not sure if you are iPhone only, but looks like knowledge/use of
whitelist is needed on Android now, too. See Paul B's:

PhoneGap Group Whitelist Comment

On Sun, Dec 25, 2011 at 8:36 PM, <he...@ashleyjwheat.co.uk> wrote:

giorgio

unread,
Feb 2, 2012, 6:49:21 PM2/2/12
to Eclipse Plugin for PhoneGap
Hi I am also trying to use the plugin that is in github to
scan QR codes, I followed the steps to install the plugin, ie I open
as android project in netbeans I have put the check is a library that
I imported into my main project, I have included the changes in my
project and the necessary files, and index.html file I've included the
javascript file, below I've included the sample code:

<script>
window.plugins.barcodeScanner.scan (function
(result) {
alert ("We got a barcode \ n" +
"Result:" + result.text + "\ n" +
"Format:" + result.format + "\ n" +
"Cancelled" + result.cancelled);
}, Function (error) {
alert ("Scanning failed:" + error);
}
);
</ script>

html code and I put a link / button that calls the method like this:

<a href="#" onclick="window.plugins.barcodeScanner.scan();" data-
theme="b"> get qrcode </ a>

I generated the apk and I tried it but when you press the button does
not get any result or error, I am doing wrong? can you help?

On 26 dic 2011, 20:41, Elizabeth Baldwin <libby.bald...@gmail.com>
wrote:
> Not sure if you are iPhone only, but looks like knowledge/use of
> whitelist is needed on Android now, too. See Paul B's:
>
> PhoneGap Group Whitelist
> Comment<https://groups.google.com/forum/#%21topic/phonegap/sfD0qlRz0t4>

Elizabeth Baldwin

unread,
Feb 3, 2012, 12:40:33 PM2/3/12
to eclipse-plugi...@googlegroups.com
Can you try to use the code in TMT3, with minimal
changes first? This code is verified to work.

Then make the changes you'd like. I am not too familiar
with netbeans.

jorge herraiz

unread,
Feb 4, 2012, 10:33:47 PM2/4/12
to eclipse-plugi...@googlegroups.com
hi, thanks Elizabeth Baldwin, I have followed exactly the tutorial
I spent and although I managed to try to launch the event that opens the scanner, todaia not gotten it to open and operate just as it will scan gives me an error and closes the application, as I can debug to see that is giving that error?

I'm kinda new to this android.

a greeting.


2012/2/3 Elizabeth Baldwin <libby....@gmail.com>

Elizabeth Baldwin

unread,
Feb 10, 2012, 11:32:20 AM2/10/12
to eclipse-plugi...@googlegroups.com
Hi Jorge.

About 85% of all problems with the barcode scanner are related
to the changes to AndroidManifest.xml, plugins.xml and
configuring the library and app projects. Please triple check
those changes (refer to tutorial and screen shots).

Please look at logcat and see if there are errors reported.

The subject of this thread has PhoneGap 1.0.0 in it, but the
current Eclipse plugin uses PhoneGap 1.4.1 - please upgrade
if you haven't already.

Libby

Shan

unread,
Feb 23, 2012, 5:15:21 AM2/23/12
to eclipse-plugi...@googlegroups.com
Hey, when i launch the QR code scanner, it works fine - it launches the camera as expected. But it occupies the entire screen and Im not sure how I can modify this page - Add a menu bar as in other pages of my app and do some css modifications ?

would appreciate if you could tell me which files I need to tinker with to modify the scanning page ?

Elizabeth Baldwin

unread,
Feb 23, 2012, 10:54:01 AM2/23/12
to eclipse-plugi...@googlegroups.com
Well, that scan screen you see is from the Barcode Scanner Library -
which is basically the ZXing Barcode Scanner -> Native App,
repackaged as an Android Library.

So - you could modify the java code used in the library that lays out
the screen.. probably not what you are looking to do.

The ZXing source is on google code. I've seen discussion on the
phonegap google group about changing the image in the scan square
area, you might search there for ideas.

Libby

e.cho...@gmail.com

unread,
Mar 8, 2012, 6:07:20 PM3/8/12
to eclipse-plugi...@googlegroups.com
Hi, 

I'm using PG 0.9.51 due to the company's requirements. 

Is it necesary to use the latest version of Phonegap?

I'm currently able to scan the code but once scanned it doesn't return to phonegap, it stays on Zxing interface until I do back+back and then I get an empty code. 

When debbuging, I can see that resultCode == Activity.RESULT_CANCELED

Any ideas?

Regards, 

Elizabeth Baldwin

unread,
Mar 9, 2012, 11:51:18 PM3/9/12
to eclipse-plugi...@googlegroups.com
The current barcode scanner tutorial and phonegap plugin
are specifically for PhoneGap 1.0 thru 1.4.1.

I may be able to send you some old files, but I won't have
access to them until next week. In general it would be better
to move forward to PhoneGap 1.4.1 for plugin support and
general improvements.

Libby

Eduardo A. Chongkan Líos

unread,
Mar 10, 2012, 12:37:12 AM3/10/12
to eclipse-plugi...@googlegroups.com
I also noticed that, after upgrade the title bar is always on top. 

Some more info about my project: 

In the Manifest: 

<uses-sdk android:maxSdkVersion="13" android:minSdkVersion="7"
android:targetSdkVersion="7"></uses-sdk>

<!-- ZXing activities -->
<activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="com.sts.eseremote.plugins.barcodescannerplugin.SCAN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.sts.eseremote.plugins.barcodescannerplugin.ENCODE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- ZXing activities -->


-----------------------------------------------------------------------
The main problem is geeting Zxing returing the date to PG. 

--
Eduardo Chongkan



2012/3/9 Eduardo A. Chongkan Líos <e.cho...@gmail.com>
Hi thanks for the tips. 

I just upgraded from  0.9.51 to 1.1.0 (migrated the addService from the JS to the xml as well) and everything works as before, all plugings are working but:

1. Zxing opens and scans the code correcttly but it then stays there. 
2. in DDMS, I see a stream of:

03-09 23:28:58.243: VERBOSE/QualcommCameraHardware(77):  native_zoom : SRC_RECT : x,y = 159,119      w,h = 320, 240

3. In order to go back to the PG app, I need to hit the back button twice and then I get an empty object (cancelled = true)

What is the default behavior? Should I expect the screen to just close and return an object which will populate the info in the alert?

Regards, 

--
Eduardo Chongkan

Eduardo A. Chongkan Líos

unread,
Mar 10, 2012, 12:32:30 AM3/10/12
to eclipse-plugi...@googlegroups.com
Hi thanks for the tips. 

I just upgraded from  0.9.51 to 1.1.0 (migrated the addService from the JS to the xml as well) and everything works as before, all plugings are working but:

1. Zxing opens and scans the code correcttly but it then stays there. 
2. in DDMS, I see a stream of:

03-09 23:28:58.243: VERBOSE/QualcommCameraHardware(77):  native_zoom : SRC_RECT : x,y = 159,119      w,h = 320, 240

3. In order to go back to the PG app, I need to hit the back button twice and then I get an empty object (cancelled = true)

What is the default behavior? Should I expect the screen to just close and return an object which will populate the info in the alert?

Regards, 

--
Eduardo Chongkan



On Fri, Mar 9, 2012 at 10:51 PM, Elizabeth Baldwin <libby....@gmail.com> wrote:

Elizabeth Baldwin

unread,
Mar 12, 2012, 6:57:59 PM3/12/12
to eclipse-plugi...@googlegroups.com
Yes, on successful scan, the plugin should return to your
app and call the provided success callback. Then you can
access data via the result object (result.text, result.format, etc).

So - something is wrong if you actually scan (green dots lock
in on image and a beep) and still have to hit the backbutton.

If you hit the back button that essentially equals a cancel,
so cancelled==true would be correct.

I've not seen any output like you provided. What version of
Android and what hardware are you using?

Problems with barcode scanner are mostly solved by reviewing
the tutorial and/or starting with a fresh app and library project.
The 2nd time through goes more quickly than the first, with
familiarity :)

Libby

vincent...@gmail.com

unread,
Feb 20, 2014, 1:23:53 AM2/20/14
to eclipse-plugi...@googlegroups.com
I have followed the TMT 3 and TMT 3 Part 2, completely no problem. 
I'm newbie in mobile app, now using the app able to scan the QR code and get the result, what I want to do next is to send the information obtain from QR code to my WAMP Server, I am using my laptop as the server to create web application like library, after the scanning the QR code information, I want my server to receive the data...

My current code is exactly same like TMT 3 Part 2, what to do next...Please help, thank you 
Reply all
Reply to author
Forward
0 new messages