ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Android PubSubTutorial QR Code Scanner Bug

asked 2012-03-01 03:47:59 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I have been running the PubSubTutorial app on my phone and it work perfectly fine except for when I try to scan a QR Code of the host IP Address. When I click the scan button in the app, it opens up the Bar Code scanner app on my phone, but when I scan the QR Code I get the following message:

"The application PubSubTutorial (process has stopped unexpectedly."

After doing some digging around in the code behind the app, in particular how it handles the QR code scanning I came across this line(80) in


After looking at what Preconditions.checkstate() and what intent.getStringExtra("Scan_Result_Format") does, I'm under the impression that the sole purpose of this line is to validate that the input is text.

If I comment out line 80 and scan in a QR code with the IP Address as text, the app works until I press "Ok" and then I get an "Invalid URI" message.

I changed my QR code to the IP Address as a URL, and the PubSubTutorial works correctly now.

Has anyone else had similar issues with scanning in a QR code? Is this line of code incorrectly implemented? Or is it a problem with my bar code scanner application not returning the expected type?

edit retag flag offensive close merge delete


Hi, I am trying to make the same app but I am having many problems with the PubSub and the scanner. May I ask for your assistance?

Elvish Champion gravatar image Elvish Champion  ( 2014-04-25 08:13:02 -0500 )edit

5 Answers

Sort by ยป oldest newest most voted

answered 2013-02-13 15:08:57 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

This bug is because intent.getStringExtra("SCAN_RESULT_FORMAT") is not "TEXT_TYPE".

I make a QR code on the following site, and the text extracted from intent.getStringExtra("SCAN_RESULT_FORMAT") is "QR_ CODE".

So, I think this is the easiest approach: line 84: Preconditions.checkState(intent.getStringExtra("SCAN_RESULT_FORMAT").equals("QR_CODE"));

But this line seems to be intented to check whether a type of the data is text or not. So I guess there is a better approach.

edit flag offensive delete link more

answered 2012-03-05 07:05:22 -0500

damonkohler gravatar image

Please file an issue and attach the stack trace from logcat:

edit flag offensive delete link more

answered 2015-04-09 21:34:41 -0500

updated 2015-04-09 21:35:46 -0500

I've used two resources are good, one is Zxing bar code scanner, another one is this bar code scanner. You can try them for getting the help.

edit flag offensive delete link more

answered 2014-06-10 22:03:12 -0500

edit flag offensive delete link more

answered 2013-01-30 19:17:05 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I know a good (QR Code barcode reader) site. I have used onece. It's good to use.

edit flag offensive delete link more


i am using this QR code decoder c# to read barcodes, you can have a try, if the error continue coming up, it says it has nothing to do with the barcode software you are using. something wrong with the barcode encoder.

foodmore gravatar image foodmore  ( 2013-08-19 23:52:22 -0500 )edit

Here is a QR Code reader I have been using for over 1 year. It is very convenient. Share it with you.

lesiewe gravatar image lesiewe  ( 2013-08-28 16:44:28 -0500 )edit

I agree with you that dealing with the QR code manipulating project with the help of some professional barcode scanner can make all the progress much more convenient.

arronlee gravatar image arronlee  ( 2013-11-04 19:50:20 -0500 )edit

Btw, I am testing with the related QR code manager these days. Any good suggestion? Thanks in advance.

arronlee gravatar image arronlee  ( 2013-11-04 19:50:33 -0500 )edit

er..actually,i'm always finding the barcode reader for my android ! as a result for my searching ,just found the barcode recognition app like what you guys mentioned .

cindy313 gravatar image cindy313  ( 2014-01-02 19:41:53 -0500 )edit

Yup indeed, I have ever tested the QR code generator before. So far so good.

arronlee gravatar image arronlee  ( 2014-05-29 23:23:38 -0500 )edit

Question Tools

1 follower


Asked: 2012-03-01 03:47:59 -0500

Seen: 2,092 times

Last updated: Apr 09 '15