AAA
AAA

Reputation: 41

Barcode scanning application camera preview stop

I am trying to implement a barcode scanning application using the open source library ZXing using the following link: https://github.com/ShyykoSerhiy/ZXingQuickStart/tree/master/src/com/shyyko/zxing/quick

Now since I am new to android programming I am facing a few problems:

  1. It's not scanning QRCODES. But the library is supposed to do it. What changes do I need to make to the code?

  2. While running the application, when the screen turns off and I open it again, the app stucks.

  3. How do I add the "search the web" option when the barcode has been scanned? Right now it only makes the toast of the barcode on the screen and nothing further happens.

  4. Scans only 1 time per opening. How do I make it multiple times?

I still have many other questions but for now I need help on these questions.

Upvotes: 1

Views: 1080

Answers (2)

ORY
ORY

Reputation: 413

There is a new Barcode API from Google maybe it is better for you https://developers.google.com/vision/

Upvotes: 0

Pararth
Pararth

Reputation: 8134

  1. It's not scanning QRCODES. But the library is supposed to do it. What changes do I need to make to the code?
    A. From the code in github, you need to merge the parts of code useful to you inside your code, eg. from where you trigger the scanning part

  2. While running the application, when the screen turns off and I open it again, the app stucks. -- A. Check the onResume() and onPause() functions of the activity you are on when the screen turns off and comment/modify it according to your need

  3. How do I add the "search the web" option when the barcode has been scanned? Right now it only makes the toast of the barcode on the screen and nothing further happens.
    A. Provide a button to trigger a google search api request from where the code is retrieved or from the line of code of the Toast

  4. Scans only 1 time per opening. How do I make it multiple times?
    A. When you merge the code, you can save the value of the scan and return to CameraScan activity from that point, as many times as you want

I suggest you go through the code of ZXingQuickStart, study and understand it first, you'l know better on what to implement, how.

Have a look at this github project: barcode scanner libraries for Android.

Upvotes: 0

Related Questions