I am not sure if this can be done. I am trying to pull a business info (mainly business name) from QR code. I am using zxing and I am able to scan it and get the URL. Now is there any other hidden info such as business name, address ..etc that I can pull from the QR code. If not, then can I use the URL maybe to get some of these info? Pleeease any insight is appreciate to how it can be achieved
PS: Ultimitally, I want the business to be shown on google map. Thats all
If the company name is recorded in a standard format in the QR code, like vCard encoding using the "ORG" attribute, then yes you can parse the raw text you get back by Intent from Barcode Scanner zxing using its ResultParser class. It will detect and parse vCard and you will get an AddressBookParsedResult object with an "org" property with this info.
Otherwise you're talking about guessing from free-form text what the company name is. There's no way to do that with zxing and that's a generally hard problem.
Related
I want to create an android app by android studio to get information from barcode such as price and name.
the thing is i am new to this so i am asking if i can make a barcode reader that scans ean-13 barcode and get price and name from database like "Open Food Facts", the exact question is how can i make the barcode reader get the price and name ? do i have to link it with some kind of data base ?
btw i am using android studio with kotlin if it helps .
And this is my first topic, i don't know how things works here so if i did anything wrong please be free to point it
You will have to link the bar code scanner with a database if you want to retrieve the information from a given barcode.
For instance, if you are scanning the QR code embedded in a book that has a unique ID, you will then need to have access to the database of all the books mapped with their relevant QR code ID.
Could you share your exact use case here as that might help us understand what you're trying to do here.
I am able to scan and obtain a QR code using ZXING. Based on the QR code obtained, I would like to navigate to a website if it is a URL or add to the contacts if its a contact detail. Are there any functions available in ZXING to do validations on the scanned QR Code?
Most definitely. Within core/ look at ResultParser (see http://code.google.com/p/zxing/source/browse/trunk#trunk%2Fcore%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fclient%2Fresult) This is where a raw result string is parsed into something structured. The Barcode Scanner source code in android/ has even more code that then ties in these results to platform actions.
Yes. https://market.android.com/details?id=com.google.zxing.client.androidtest&hl=de
Somewhat beta, but should help you.
Oh sorry, now I got it. Basically a QR-Code is just a String with some fancy stuff arround. If your App scans a QR-Code via xzing, you should only get the information without the fancy stuff. But if its an URL or a Contact or something else you have to decide yourself programatically, because you can store every kind of information inside a QR-Code.
Is there any algorithm which can parse or decode the String results obtained from BarCode Scanner using Zxing?
I want to extract Lot number or serial number from the scanned result. Is there any standard algorithm to do so?
I currently use,
String lotNumber=scanResults.substring(24,26);
if (lotNumber.equalsIgnoreCase("10")){
System.out.println("Lot numberrrrrrrrrrr " + a.substring(26,a.length()));
}
Thanks
Sneha
Look at the class ResultParser. It will try to parse the result string as something more meaningful. For example "mailto:foo#example.org" would come back as EmailParsedResult, letting you know it's an email address and parsing out the address for you.
I am not sure what this lot number is -- it's not well-known and so not implemented outside your system. But yes you can find a lot of this kind of logic in the project already, which you can perhaps reuse and modify.
no there is no magic in java or any language which can tell you what is that data for which that bar code was generated. You should know the data and should know its content type (json, xml etc) and then use the parser. Or if its not as per the defined standards (any random string) than do as what you are doing.
Is there a way to integrate a mobile database for your app? If so, is it extremely hard? I have not yet started on any code, I just would like to know how it can be done and the measures that encompasses such a desire to integrate a database for the android app.
I would like to do the following:
A user would like to search for a restaurant nearby...they think they know the name of the restaurant, so they begin typing letters. If they type a U, all the restaurants that start with a "U" will show up. Once they find the restaurant they are looking for, they click on it and get the information.
Can this be done?
Thank you.
AFAIK, this is how it works, company who have database need to give you a URL which takes your search term as parameter and returns either XML (or) Json as response. You need to invoke that url by appending your search terms (entered by user) with help HTTPClient API from android, which return corresponding results either XML (or) Json. If Json response you can use android JSonObject api to parse the response. If XML response, you need to use SAX/DOM parsers.
I use ZXing to scan a regular barcode (not QR code) and I get a scanresult string, or to be more precise a number.
When I scan QR codes, it's easy to use the result because it always contains a URL to the Android Market. But how to use the number from a regular barcode? Which "search engine" to use to get the right product?
PS. quering this result number via google.com or Google Shopping returned no product at all
I've never used ZXing, but I see that it supports many barcode types. The type of the barcode will determine where you can look for it (i.e. it depends what you mean by a 'regular' barcode). If it's a UPC barcode, you can use something like this site.
If it's an ordinary 1D barcode, it might turn up in the UPC database. Other than that, there's not a strictly universal barcode database. Amazon's ecommerce API might help (it supports UPC lookup, but I don't know if it supports non-current products), and if you're in the UK then Tesco's has one as well that's worth a look.