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?

5
  • 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) Commented May 25, 2012 at 14:36
  • 1
    There is an example in the accepted answer of this question: android-how-to-read-qr-code-in-my-application Commented May 25, 2012 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.. Commented May 25, 2012 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. Commented May 25, 2012 at 14:46
  • I have no problem using it, i just dont want the user to download another app Commented May 25, 2012 at 14:49

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

But how do i use ZXing INSIDE my application, so the user doens't have to download it??
Use @Chilledrat's solution and you should be fine.
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.