1

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?

rel-s
  • 6,108
  • 11
  • 38
  • 50
  • You don't have to fully understand zxing source code to use it. There's an easy way of implementing the zxing code scanner via intent, look it up please, because your question doesn't really qualify as a good one by SO standards (hence the downvote from someone) – Michał Klimczak May 25 '12 at 14:36
  • 1
    There is an example in the accepted answer of this question: [android-how-to-read-qr-code-in-my-application](http://stackoverflow.com/questions/8831050/android-how-to-read-qr-code-in-my-application) – Chilledrat May 25 '12 at 14:39
  • But i want it to be implemented in my app, and i dont want my user to have to download it from the marketplace.. – rel-s May 25 '12 at 14:39
  • But then you have the headache of keeping your app up to date just because the library you are using has had updates (say security issues, for the sake of argument), or were you planning on writing it from scratch :) ? Besides you are missing one of the advantages of android, reusing others work to help your own, allowing you to working on other cool features instead of reinventing the rocket. – Chilledrat May 25 '12 at 14:46
  • I have no problem using it, i just dont want the user to download another app – rel-s May 25 '12 at 14:49

2 Answers2

3

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.

Chilledrat
  • 2,593
  • 3
  • 28
  • 38
Kai
  • 15,284
  • 6
  • 51
  • 82
1

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.

Community
  • 1
  • 1
Chilledrat
  • 2,593
  • 3
  • 28
  • 38