Sunday, January 27, 2013

PhoneGap Plugin Updates to BarcodeScanner and AppPreferences

I've updated the BarcodeScanner and AppPreferences to use the Apache Cordova 2.2.0 API's. That means no more deprecation notices in the Java code and the JavaScript code uses the cordova.require method. However, I'm still slapping the objects into window.plugins so you shouldn't need to change any of your JavaScript code after upgrading.

The BarcodeScanner code has also been updated to use the ZXing 2.1 library. If all goes well there I will contact Ryan over at PhoneGap Build to pick up my changes.

Next up will be the GalleryPlugin. The only thing holding it up is that I want to add a remove method to go along with the add.

11 comments:

Unknown said...

Can you please tell us how we get this to work with iPhone - I can seem to get it working

Simon MacDonald said...

@Russell Harrower

Not sure if the iOS plugin has been updated for 2.3.0.

George said...

Simon>

I have older version of barcodescanner libarary project working wonderfully with my app using Cordova 1.9. ( my older version of barcodescanner lib project is identical to
https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner/LibraryProject )

Now I am in process of upgrade my app to use Cordova 2.4. The first thing I did is to update the barcodescanner lib project to 2.2.0 folder
https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner/2.2.0/LibraryProject

I copy/pasted all files from 2.2.0 version into the old one and refreshed my project in Eclipse and cleanly rebuilt and I got the following error.

Description Resource Path Location Type
NDEF_SMART_POSTER cannot be resolved or is not a field NDEFSmartPosterParsedResult.java /BarcodeLibrary/src/com/google/zxing/client/result/optional line 37 Java Problem

Description Resource Path Location Type
This static method cannot hide the instance method from ResultParser NDEFSmartPosterResultParser.java /BarcodeLibrary/src/com/google/zxing/client/result/optional line 34 Java Problem

Description Resource Path Location Type
This static method cannot hide the instance method from ResultParser NDEFTextResultParser.java /BarcodeLibrary/src/com/google/zxing/client/result/optional line 30 Java Problem

Description Resource Path Location Type
This static method cannot hide the instance method from ResultParser NDEFURIResultParser.java /BarcodeLibrary/src/com/google/zxing/client/result/optional line 69 Java Problem

Description Resource Path Location Type
Type mismatch: cannot convert from CharacterSetECI to ECI ECI.java /BarcodeLibrary/src/com/google/zxing/common line 47 Java Problem

Any idea what is going on? Am I missing somefiles?

Thanks,

George

George said...

Simon>

I think I figured out. I needed to empty destination folder before copy paste in.

Those errors were from files no longer exist in newer version.

It seemed that asking the author always helps.

Thanks,

George

Unknown said...

I add barcodescanner plugin into my phonegap, it work
well and nicely, it is a pity that my app expand about 500k+, how to just use core lib( thinner)?

Simon MacDonald said...

@expert china

Well it is an open source plugin so feel free to modify it yourself to reduce the size. I don't have the time nor inclination to make the changes.

jiterziev said...

Thank you for the super usefull plugin! I copied the BarCode plugin from 2.2.0 folder and I'm using Cordova 2.7.0 and API 17. Everything is configured right, application is starting but cannot connect to the camera :( Any ideas?

Thank you in advance!

Simon MacDonald said...

@jiterziev

Need more info, what do you see in "adb logcat"?

Unknown said...

Hi Simon do you have a basic project that has phonegap and your barcode scanner plugin working I am really struggling to add the plugin to my project I'm getting No resource found that matches the given name (at label with value @string/share_name) in the manifest file. Can you help?

Unknown said...

I forgot to mention I'm using android studio not eclipse.

Simon MacDonald said...

@Lee Doel

Sample projects are at:

http://simonmacdonald.blogspot.com/2012/10/barcode-scanner-example-projects.html

I have not upgraded them to Android Studio at this point.