My company has a project coming up where we need to create a mobile app capable of scanning PDF417 barcodes found on North Dakota driver's licenses. We found an excellent PDF417 barcode scanner from PhotoPay at http://pdf417.mobi. It works great and is very easy to implement in a native Android app.
The standard Zxing scanner only has alpha support for PDF417 and it does not work very well. I've only gotten it to work consistently with fairly simple PDF417 codes. The more complex ones found on driver's licenses I've only gotten to work occasionally on higher end phones with very steady hands.
Since most of our developer experience has been in .Net instead of Java, we are now looking at the Xamarin product to see if it would work for us. It looks like an excellent product so far, but I seem to be having some issues getting it to work with the PhotoPay scanner.
The PhotoPay library is pulled out of git and has 3 projects. One of these is a project with some library references and resources and is meant to be referenced from your own application. That application then needs to add an intent filter to tie to an Activity class found in the Pdf417MobiSdk.jar file.
Now I am trying to get something similar working in the Xamarin solution. I am working with Visual Studio 2012 using a trial Business Account for Xamarin. I created 2 projects. Pdf417 is a Java Bindings Library and AndroidTest is an Android Application.
For the Pdf417 library I dropped the PDF417MobiSdk.jar into the Jars folder and set the build action to EmbeddedJar. I also zipped up the bin, res, and libs folder of the native reference project. I did not include the PDF417MobiSdk.jar in that zip file since I was including it in the Jars folder as an EmbeddedJar. That zip file was then added to the project as a LibraryProjectZip.
I ran into several issues try to compile this project with what appeared to be obfuscated classes. I added the following to the Metadata.xml to ignore these classes:
<metadata>
<!--
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
-->
<remove-node path="/api/package[@name='net.photopay.hardware.camera.focus']/class[@name='llIIlIlIIl']" />
<remove-node path="/api/package[@name='net.photopay.hardware.camera']/class[@name='llIIlIIlll']" />
<remove-node path="/api/package[@name='net.photopay.hardware.camera']/class[@name='lIIIIIlIlI']" />
<remove-node path="/api/package[@name='net.photopay.secured']/class[@name='IlIlllllII']" />
<remove-node path="/api/package[@name='net.photopay.secured']/class[@name='llIIlIIIll']" />
<remove-node path="/api/package[@name='net.photopay.geometry']/class[@name='IlIllIlIIl']" />
</metadata>
After I got my Pdf417 project up and running, I added a reference to it to the AndroidTest project and added some code to handle the launch of the scanner and get back a response. I ran into a number of issues that I eventually worked out and currently have everything running pretty well with a Debug build. However, when I try to compile a Release build I get the following error:
Error 82 cannot find symbol
symbol : class EventListener
location: interface net.photopay.view.viewfinder.IViewFinder
net.photopay.view.viewfinder.IViewFinder.EventListener
D:\Projects\Nexus\Xamarin\AndroidTest\AndroidTest\obj\Release\android\src\mono\net\photopay\view\viewfinder\IViewFinder_EventListenerImplementor.java 8 43 AndroidTest
This error appears to be in a temporary Java file that is being generated. This same file is NOT being generated in the debug build. I've attempted to clean the Release build and rebuild, but it always gets generated again.
The bit of code that the error occurs at looks like:
public class IViewFinder_EventListenerImplementor
extends java.lang.Object
implements
mono.android.IGCUserPeer,
net.photopay.view.viewfinder.IViewFinder.EventListener
I've zipped up the solution and put it in a public Skydrive folder in case anyone more familiar with Xamarin than I feels inclined to take a look. This is also an error I had gotten along the way of getting the Debug build working, but it had appeared to magically disappear. I hate when things like this magically start working because I like to understand what it is that was wrong to begin with. :)
The zip file is located at https://skydrive.live.com/redir?resid=2386EA525D9FA8AB!495&authkey=!AHGBcr8QJ_NmN2Q