Integrate ZXing QR code scanner without installing BarCode Scanner

后端 未结 7 1477
忘掉有多难
忘掉有多难 2020-12-02 13:39

I am trying to Integrate ZXing QR Code into my android app without installing BarCode Scanner app, I have followed the steps as:

1) Firstly I have downloaded ZXing.z

7条回答
  •  醉梦人生
    2020-12-02 13:58

    For all those Android Studio/Gradle users out there

    Okay guys, as my task today was to integrate ZXING into an Android application and there were no good sources for input all over, I will give you a hint what made my be successful - cause it turned out to be very easy (on version 2.*).

    There is a real handy git repository that provides the zxing android library project as an AAR archive.

    • https://github.com/embarkmobile/zxing-android-minimal

    All you have to do is add this to your build.gradle

    repositories {
        mavenCentral()
    
        maven {
            url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
        }
    }
    
    dependencies {
        compile 'com.google.zxing:core:2.2'
        compile 'com.embarkmobile:zxing-android-minimal:1.2.1@aar'
    }
    

    and Gradle does all the magic to compile the code and makes it accessible in your app.

    To start the Scanner afterwards, use this class/method:

    IntentIntegrator.initiateScan(this);    // `this` is the current Activity
    

    If you already visited the link you gonna see that i just copy&pasted the code from there the git readme. If not go there to get some more insight and code examples!

    Hope to be helpful for future readers. Peace :)

提交回复
热议问题