0

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

Burhanuddin Rashid
  • 5,260
  • 6
  • 34
  • 51
Devendra Shewale
  • 407
  • 1
  • 5
  • 14
  • How are you including the library in your project? Have you included the target Activity in your app's Manifest? – npace Sep 28 '16 at 13:06
  • Hi Burhanuddin thanks for your quick response , yes I have added library in my project and also mention in the app manifest and its working fine on android 5.1 above version phones properly – Devendra Shewale Sep 28 '16 at 13:11

1 Answers1

1

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" />
nishith kumar
  • 981
  • 7
  • 20