I'm developing an android app for my client and he requested QR scanner to be built inside the app. So, I don't want that users have to download another app from GooglePlay. In other words, I don't want to call another app that is QR scanner from my app. I need QR scanner to be built inside my app.
I have read about ZXing on github and here, on stackoverflow. The way I understand it, it is not good idea to integrate its QR scanner inside app. It is better to call scanner via Intent (or IntegratedIntent as it is called) and again, it will call another scanner app (?) which has to be downloaded from GoolePlay previously and I don't want that.
Also, I tried few ideas from several blogs (How to Create QR Codes with an Android Phone, ZXing QR Reader Direct Integration) and it did work well.
Is it possible, somehow, to built in already developed QR scanner?
Well I found the solution. Problem was this: I was using IntentIntegrator for some reason:
IntentIntegrator integrator = new IntentIntegrator(MainActivity.this);
integrator.initiateScan(IntentIntegrator.QR_CODE_TYPES);
If you use IntentIntegrator iw will request BarCode scenner app to be installed on device, even if you added CaptureActivity project as a library to your project.
I used this instead and it works gr8.
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
It will start CaptureActivity, from CaptureActivity project, and scanner will be inside your app.
P.S. It is neccessery to put this code in manifest file inside tags:
<activity
android:name="com.google.zxing.client.android.CaptureActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>