2

I have successfully integrated zxing core.jar library below android Marshmallow, but while integrating this into above Marshmallow, it gives me following error:

android.content.ActivityNotFoundException: NO activity found to handle
intent{act=com.google.zxing.client.android.SCAN}

Thanks in advance.

Sneh Pandya
  • 8,197
  • 7
  • 35
  • 50

3 Answers3

0

@ Kevin Robatel my manifest

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

and following code executes onClick of button

try {
        Intent intent = new Intent("com.google.zxing.client.android.SCAN");
        //intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
        startActivityForResult(intent, BARCODE_CAPTURE_ACTIVITY);
    } catch (ActivityNotFoundException anfe) {
        Toast.makeText(mContext, "Scanner Not Found "+anfe.toString() , Toast.LENGTH_LONG).show();
    }
Sneh Pandya
  • 8,197
  • 7
  • 35
  • 50
0

I think the problem may be in runtime permission of Camera. Try to give an access it to your app in code or manually

Vlad
  • 7,997
  • 3
  • 56
  • 43
0

You should edit code at Manifest file:

<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.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="com.google.zxing.client.android.SCAN" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

And don't forget add permission:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
LVS
  • 76
  • 1
  • 3