I am doing Bar code scanning functionality in my Android APP using ZXing Library When I am calling Capture activity of ZXING library using following intent then I am getting activity not found exception in below android 5.1 versions phones
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.setPackage("com.google.zxing.client.android");
intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE","QR_CODE_MODE");
startActivityForResult(intent, position);
and I am getting following exception
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN pkg=com.google.zxing.client.android (has extras) }
Please help me to resolve this issue
Add below code to your manifest file :
<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>
And the fllowing permissions
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />