How do I get the barcode scanner to know what to look for after scanning

296 views
Skip to first unread message

M Jordan

unread,
Mar 1, 2015, 1:38:15 PM3/1/15
to mitappinv...@googlegroups.com
So I can get the barcode scanner to launch and scan a barcode.  It returns with the number at the bottom of the barcode, but how do I get it to know what that item is?  Let's say I scanned the barcode for a roll of tape or a can of soup, and I want it to return a description of that item, sort of a "Oh, you just scanned the barcode for a 100ft roll of gray duct tape made by 3M."  I can't figure out how to make it do that.

Taifun

unread,
Mar 1, 2015, 2:20:35 PM3/1/15
to mitappinv...@googlegroups.com
you can access an API using the web component
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

M Jordan

unread,
Mar 2, 2015, 2:44:30 PM3/2/15
to mitappinv...@googlegroups.com
Ok, thanks for that response!  Unfortunately, I'm so completely new to this, I don't have a clue what to do with the information you provided (or that outpan provides for that matter).  So let me back up a step or two.

I've done a number of the tutorials, and so many of them tell me "what" to do, but not much on why.  So I'm learning by just rote memorization which doesn't help me apply the information to other apps.  Is there someplace within app inventor that tells me how all the different little plug in "thingys" (sorry, half asleep, can't remember what they're called.  Blocks maybe?) work?  Like for instance I just learned that you can call for data, but once data is returned, you have to tell the app what to do with it.  And initializing global whatevers.  When do I have to do that?  Don't get me wrong, app inventor beats the pants off android studio or God forbid, writing it all out long-hand in code.  But I'm extremely frustrated because I need an explanation of all the block plug-in things so I know which one I need to use at any given time.  Arrgghhhh!  Hellllppppp!!!!!

Taifun

unread,
Mar 2, 2015, 3:00:14 PM3/2/15
to mitappinv...@googlegroups.com
you might prefer to try one of the books to learn App Inventor?
see here http://www.appinventor.org/ this is also available in pdf format
or try Hossein's book (you can search here in the forum)
Taifun

SteveJG

unread,
Mar 2, 2015, 3:07:27 PM3/2/15
to mitappinv...@googlegroups.com
You need explanations?    Here is a huge pile of them you may find useful  http://www.appinventor.org/book2    The links to the free eBook chapters are at the bottom of the Web page and entitled Inventor's Manual.  This neat 'book'  teaches you how to program AI2 blocks and why.  Also on the main page is a Course In a Box .... also free.

These resources may help you understand what is done and why.

Regards,
Steve

M Jordan

unread,
Mar 2, 2015, 3:34:55 PM3/2/15
to mitappinv...@googlegroups.com
Thanks everyone.  I also just discovered the Concepts page and the Glossary page on AI2.  For instance, I've just learned what "event handlers" are, and it helps.  Still don't know how to use an API or JSON data, but I'm getting there.  If anyone is reading this going, "Oh, man, this is SO easy, I wish I could just tell him how to do this," feel free, although I'm eager to start making a bunch of apps primarily for me and my family to use, so I've GOT to learn it eventually.

But here's what I'm working on.  And SteveJG, you were helping me before on this, but that thread appears to have gotten closed down.  Anyway, I've created the very basics so that on the Designer screen I have a "Scan" button and a few text boxes.  And when I load it onto my phone, I push the scan button, I can scan a barcode (say of a can of soup), and it returns and displays the 9(?) digit number listed at the bottom of the barcode.  The next step I need to figure out is how to get the app to look up that barcode, find its description, and return that information into (what I will call) a text box and a list/database so that I can scan 2 or 3 or 4 items, store them temporarily, then push another button that is labeled something like "Look up" and will cause the app to do a google search for partcular returns using those items.

For instance, I'm into model airplanes.  So let's say I want to scan the barcode of some balsa wood, super glue, and x-acto knife blades.  Then I want to do a google search for hobby shops, and only hobby shops, that sell all those items.  Scan, store and display description for item 1; repeat for item 2; etc. Look up, display results.  Anyone feel like walking me through it?  

Taifun

unread,
Mar 2, 2015, 7:02:20 PM3/2/15
to mitappinv...@googlegroups.com
do it step by step and if you have a problem, post a screenshot of your relevant blocks
Taifun

SteveJG

unread,
Mar 2, 2015, 7:12:49 PM3/2/15
to mitappinv...@googlegroups.com
You did not read the AI2 eBook yet?    A shame.    Look at chapter 13  http://www.appinventor.org/bookChapters/chapter13.pdf      This chapter appears pretty much what you want to do; the article revolves around books, not balsa wood. The problem is that you will have to find an API that will point to hobby goods.   I do not know how to do this or if even one exists; you have to search.

Regards,
Steve

Abraham Getzler

unread,
Mar 2, 2015, 8:53:32 PM3/2/15
to mitappinv...@googlegroups.com
For starters, try using the TEXT JOIN block to build a URL like
from your favorite web based UPC WEB REST API
and from the digits you got back from your scan,
then launch a Web Viewer from it.

You can pick out the pattern of how the URL is built
just from typing codes into the various UPC search sites
and reading the resulting URLs in your browser address window.
ABG

M Jordan

unread,
Mar 5, 2015, 1:00:16 PM3/5/15
to mitappinv...@googlegroups.com
Well SteveJG, I haven't read all of it, I'm sort of one of those dive-right-in-read-directions-as-needed types of people.  But I have read 13, but I'll go back and look again.  Taifun, Abraham, thanks for your replies.  Going to give it my best go here soon.
Reply all
Reply to author
Forward
0 new messages