ZXingTestActivity - barcode scanner - No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN (has extras) }

前端 未结 3 1676
栀梦
栀梦 2021-01-17 14:36

I\'ve been trying to build an application that uses barcode scanner, and I\'ve decided to try out the example found in the ZXing-2.0.zip ,s

相关标签:
3条回答
  • 2021-01-17 15:04

    I've fixed the problem you can find the solution here

    What you need to do is add the mentioned piece to the manifest file. Good luck!!

    0 讨论(0)
  • 2021-01-17 15:08

    Just Add this Code into your manifest file, with in the Application tag.

    <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>
    

    Now add permission if not already added on the top of file

     <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    
    0 讨论(0)
  • 2021-01-17 15:09

    I solved this problem. you can look this page"http://pastebin.com/J5EV72Cu".
    Error coding

    String packageString = "com.google.zxing.client.android";
    Intent intent = new Intent("com.google.zxing.client.android.SCAN");
    intent.setPackage(packageString);
    intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
    startActivityForResult(intent, 123);
    

    Solve coding

    String packageString = "com.yourapplication.packagename";
    Intent intent = new Intent("com.google.zxing.client.android.SCAN");
    intent.setPackage(packageString);
    intent.putExtra("SCAN_MODE", "SCAN_MODE");
    startActivityForResult(intent, 123);
    
    0 讨论(0)
提交回复
热议问题