Reputation: 6138
I would like to implement a QR code scanner in my application the will support my own format of text in it. Not a contact, phone number or anything like that. just some information like this:
Format:"ID:1345986;CONFIRM:1839584;NAME:JOE BAHAMA;"etc...
Now, i have looked at the ZXing source code and i can't quite understand it... I need a way to do this like a mentioned up.
Any suggestions?
Upvotes: 1
Views: 7359
Reputation: 15476
Fundamentally QR Code just encode a string of characters, as explained in the zxing wiki (for example, the prefix "tel:" indicates to the reader that it's a telephone number and that the reader should take an action appropriate to a telephone data).
So all you really need to do is just use ZXing to decode QR codes to strings and do the parsing.
Upvotes: 3
Reputation: 2605
There is an example here Integrate zxing barcode scanner into your Android app natively using Eclipse*, which shows how to include the zxing .jar
in your project, however it starts with a note of caution:
Sean Owen, one of the developers for ZXing has posted a comment to this blog warning of the pitfalls of integrating ZXing into your own app; doing so just to avoid having your users take that extra step of installing from the market is not a good reason. I completely agree with this. There are many advantages to using the intent based approach as outlined in his comments. My motivation is for an enterprise app that does not have access to the Android market and involves my client installing zxing manually on thousands of devices before they are able to distribute to its business customers.
So to be clear, do not use this method unless it is absolutely necessary, and if you do have to – make sure that override your intent filters so that other apps that want to use zxing do not end up calling your modified version. Also, if zxing is already installed, then you should use that by default instead of your modified version.
.* Found by Googling "adding zxing to an android app" and clicking the first link.
Upvotes: 1