I am developing a new application which hopefully will use a barcode reader to scan and find books. I will then use the ISBN information to get more information.
The intents work and I can scan 2d barcodes ok but not the 1d barcodes of books which I know scan fine using the full application.
This is my code. I have tried it without putting the intent extras and it doesn't change anything.
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "ONE_D_MODE");
startActivityForResult(intent, 0);
Is there something obvious I am missing? The settings in the app also are selected on 1d scanning only.
Thanks
Turns out that using product mode worked perfectly. I don't know why I didn't try that earlier!
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
(Probably easiest if I answer in just one place: http://code.google.com/p/zxing/issues/detail?id=574 )
Related
I am trying to open gallery on Nexus 7 with Android 6.0. It does not have in built gallery, but it does have the Google Photos app.
I am using the following code to open the gallery :
Intent i = new intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
// Always show the chooser (if there are multiple options available)
startActivityForResult(Intent.createChooser(i, "Select Picture"), PICK_IMAGE_REQUEST);
The above code works well in all the versions below 6.0. And Please note that I am already using RUN TIME PERMISSIONS for accessing gallery and have given the permission to access gallery / or externa storage.
Now when the code is executed, I get a transparent screen with heading "Select Picture" and in the middle a text No Apps can perform this action.
Now what do I do to pick or choose image and use in my app.
Any help is appreciated.
Thanks
I am using the following code to open the gallery
That code has nothing to do with a "gallery". That code is requesting to pick a piece of content from a particular collection of content. There may be zero, one, or several activities on the device that offer to support that Intent structure.
The above code works well in all the versions below 6.0
Only on devices that happen to have one or more activities that satisfies that Intent structure.
Now what do I do to pick or choose image and use in my app.
Intent i = new intent(Intent.ACTION_GET_CONTENT).setType("image/*");
// use PackageManager to see if there is anything that supports this
// Intent structure, or just blindly make the following call and handle
// the ActivityNotFoundException
startActivityForResult(i, PICK_IMAGE_REQUEST);
I am using this code , so that only gallery opens and not any other option to pick image
There is nothing in your code that limits it to just a "gallery".
Not allowed to comment because I don't have enough points. But here's just a suggestion, how about if you just passed the intent directly? Like this:
startActivityForResult(i, PICK_IMAGE_REQUEST);
Use this line of code rather than what you have done
Intent i = new intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, PICK_IMAGE_REQUEST);
im new to all the programming stuff so please forgive me If my question is rather stupid ;)
I integrated zxing directly as a library and now im trying to scan some QR Codes and get the result. But sadly I have no idea how to get it.
I found some hints that it works with "onActivityResult(int requestCode, int resultCode, Intent intent) "and for that i have to declare a new intent like this
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
But if I copy this code to my app, it will always try to open a thirdparty app. Thats exactly what i dont want.
Im sure my mistake is very obvious, but I dont see it ;) Would be happy about every help.
If I'm not getting you wrong, you want to display ZXing natively.
To do that please follow this tutorial
http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/
In case of any doubt please let me know.
Regards.
I am using Zxing Barcode scanner app to scan bar codes using
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
I could get the result in onActivityResult.I want to display the value of QR code and the QR code itself.
I am unable to figure out how can I scan and capture the image of the QR code at the same time.
Any way to achieve that?
ZXing doesn't actually take a picture when doing scanning. It does "capture" the image off the camera feed, but it doesn't persist anything to the SSD card or memory. You can get at the raw bytes if you're scanning with the IntentIntegrator code they post on their site.
http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentResult.java
You can see the IntentResult has the raw bytes. I don't exactly know what format it is in, but I bet you can pass it to Bitmap to get the image.
I am using Zxing Barcode scanner app to scan bar codes using
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
It works fine. I could get the result in onActivityResult. No problem. I dont want QRCode to be displayed. I mean I don't want to let the end user know the qr code string. But in the history available in the original barcode scanner app, it is showing up the list of QR's scanned. So, how do i make the QRStringfrom my app invisible in History
"SAVE_HISTORY" from package com.google.zxing.client.android.Scan;
/**
* Setting this to false will not save scanned codes in the history.
*/
public static final String SAVE_HISTORY = "SAVE_HISTORY";
Then something like,
intent.putExtra("SAVE_HISTORY", false);
Try this and let me know what happen..
I'm a new android developer, and I try to create an app for using bar code. I try ZXing, it is very easy. But now I need get information about product by bar code. How can I do that?
You'll need to use some kind of web service to look up the product information associated with an UPC/EAN code using for example an AsyncTask. A quick Google search turned up the Internet UPC Database.
Here's a sample record of what data they provide: http://www.upcdatabase.com/item/0081697521221
Please carefully read their ToS: http://www.upcdatabase.com/docs/terms.asp
To use one dimensional barcodes use PRODUCT_MODE.
If you want to be able to scan them all don't set anything in extras scan_mode.
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.setPackage("com.google.zxing.client.android");
//intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
startActivityForResult(intent, 0);
Bar code gives you nothing but a number (product number). You need to have a web service where you can send this number to get more details.
you have to call the barcode reader by intent, then the user scans the barcode(if they have the barcode reader installed), and the barcode reader sends the data to your app
here's the code on how to do it.
http://code.google.com/p/zxing/wiki/ScanningViaIntent
as you can see in public void onActivityResult
these are the data returned by the scanner
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");