How to use ZXing library without installing barcodescanner app - android

I have been developing an android app to scan the barcode and QR code and send the results to some other application (HTTP). I have read most of the documentation over internet and here in stack over flow and got it working. I could able to run the stand alone zxing android app on my device, also I could run my own separate android app to use Zxing intent to scan the bar code.
But even after reading so many questions here and some of the blogs in internet, I could not get my strict requirements.
I want to achieve following things.
1. I do not want to install a separate barcode scanner app in my device to get my own app to work (to scan the barcode).
2. I used following code
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
startActivityForResult(intent, 0);
and when I run the app in my devide, it asks 'Select the application to complete this action' and it shows 'Google' and 'Google Goggles' and it opens the Google page default camera and scans the barcode. I wanted CaptureActivtiy default capturing page to come (not Google's one) to scan the bar code.
3. I have tried using ZXing in my own app as library but it did not work.
Could you please tell where exactly I am going wrong to get this done ?

I found "zxing" complicated to use. Then I tried with "ZBar Android Version Library". It was so simple.
You can download the library from here: http://sourceforge.net/p/zbar/news/2012/03/zbar-android-sdk-version-01-released/
Within the downloaded package, there is a very simple example. Just follow it or include the example to your app. Hopefully your task will be done.

You are showing that you want to integrate by Intent. That's the recommended way to do it, and you can make it even easier, and restrict the list of apps that reply with IntentIntegrator. It's about 5 lines of code: https://code.google.com/p/zxing/wiki/ScanningViaIntent
However this contradicts what you're saying about wanting to implement the scanning in your app. You should clarify what you want.
If that's the case, you need to build your own scanning app, and reuse core.jar and perhaps bits of Barcode Scanner in android/. This is not supported -- you're on your own. Please don't clone our app.

Related

How to debug a QR code enrollment procedure with factory reseted device?

I'm trying to build a DCP app with QR code enrollment.
After various tries and error messages the least one I got is the following:
So my question is, can I somehow turn on the USB debugging to go and see whether Android tells me something important about this error via logcat, because right now I'm searching for a needle in the haystack.
This device is Android 7 which does support QR code enrollment as it is stated in the documentation.
I tried to modify the QR code with every possible scenario like adding and removing parts, trying different encoding but in the end all of those tries just sent my further from the solution.
Any insights?

Not able to find solution for detecting camera button for different devices in Espresso script to be run on Firebase Test Lab

I have to create a script using Espresso to test my app in Firebase test lab. My app uses Camera to capture images and I have opened the default camera app.
For testing on my device I give package name for the testing device that I am using. The issue is that the camera app package names for different Android devices is different, and we do not know each of it. Also it is not good to hard code package names.
I have searched out and not able to find a way to find a solution.
Thanking in advance.
I don't think there's a good way to do this with the actual camera app, since the camera app often differs between device models and Android versions.
How about you fake this dependency in your tests? Either by abstracting the code that calls the camera app, or by adding your own fake camera activity that will get called and returns you a picture the way it's supposed to happen.
You can use android.support.test.espresso.intent to mock camera launch intent
https://guides.codepath.com/android/UI-Testing-with-Espresso#stubbing-out-the-camera
also ref:
http://www.qaautomated.com/2016/02/testing-camera-activity-using-intent.html
check google sample
https://github.com/googlesamples/android-testing/tree/master/ui/espresso/IntentsAdvancedSample

ActivityNotFoundException while using ZXing

Android 2.3.3
As with most of the people using ZXing (new to using ZXing), I am getting the ActivityNotFoundException (I guess there is no need to paste my logcat as it's the same with all other people).
I have seen few questions related to ActivityNotFoundException with ZXing. Here is what I have understood so far. Please correct me if I am wrong..
If I have to use ZXing in my app, there are two options :
I can use the Intent and startActivityForResult(), if the user already has the ZXing application installed, and if doesn't, I can redirect him to the playstore to install it first and then use my application.
For my application to work, even if the ZXing application is not installed, I can add ZXing library to my project as a library, copy the code of IntentIntegrator class(from here) into a seperate class in my application and use IntentIntegrator. Is this the intended purpose of IntentIntegrator? or Am I getting it completely wrong?
Can someone help me with my doubts?
EDIT::: Seems like the second approach also needs to have the ZXing application installed on the device. Is there a way, that my application can work, without the need of ZXing app installation?
You haven't installed Barcode Scanner. Please use the IntentIntegrator as directed already in the documentation: https://code.google.com/p/zxing/wiki/ScanningViaIntent
It will handle installation for you.

Zxing intentIntegration usage

I am trying to implement a custom barcode scanner. If I have Zxing installed the app works fine but If I do not the application will error out and you have to force close. I have added IntentIntegrator.java and IntentResult.java into the SRC folder of my project and changed the package name to point to my package, although Im not sure if that is what I am supposed to do. It still will not work. Am I setting this up correctly? I have found many pages that tell me to use the files but not how to set them up to work.
I would like it to smoothly direct the user to download the zxing app from the market if it is not installed on the client phone.
It's because you are not handling ActivityNotFoundException, or checking first to see if the app is installed. That is up to you. But, if you used the provided integration code, it would do this all for you. See http://code.google.com/p/zxing/wiki/ScanningViaIntent
It's not going to launched your app though, no.

Is it possible to configure an Android install to run a single app?

Is it possible to configure the Android OS to run only a single app?
Basically what I want to do is customize an Android device so that it boots up and runs one application only, and for that application to be switched to the front of the screen automatically. Also, when it gets closed, to be started up and switched to again. Any ideas?
Thanks,
-David
One method is to get the source of Android and write your own custom ROM of Android as Octavian wrote.
Another alternative would be to write a custom home app that, well, isn't really a home app (but replaces the default home app intent). See SlideScreen as an example of a non-traditional "home" app.
Yes it is possible. You have to fetch yourself the source codes for Android and basically create a custom ROM. After applying all desired modifications you bake your ROM and install it to your device.
Pretty much all you need to know about the source and the process of compiling the sources are located at Android Sources. You can view the source codes from your browser by following this link.
Hope it helps you a bit. Good luck.

Categories

Resources