Android, How to read QR code in my application?

前端 未结 7 1977
耶瑟儿~
耶瑟儿~ 2020-11-29 16:11

In my application I need to read Qr code. I searched the net and found Zing codes however lots of developers had problem with using it and it seems it is buggy!

If i

7条回答
  •  -上瘾入骨i
    2020-11-29 16:37

    if user doesn't have any qr reader, what will happen to the application? if it crashes, may i ask user to download for example QrDroid and after that use it?

    Interestingly, Google now introduced Mobile Vision APIs, they are integrated in play services itself.

    In your Gradle file just add:

    compile 'com.google.android.gms:play-services-vision:11.4.0'
    

    Taken from this QR code tutorial.

    UPDATE 2020:

    Now QR code scanning is also a part of ML Kit, so you can bundle the model inside the app and use it by integrating the following gradle dependency:

    dependencies {
      // ...
      // Use this dependency to bundle the model with your app
      implementation 'com.google.mlkit:barcode-scanning:16.0.3'
    }
    

    Or you can use the following gradle dependency to dynamically download the models from Google Play Services:

    dependencies {
      // ...
      // Use this dependency to use the dynamically downloaded model in Google Play Services
      implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:16.1.2'
    }
    

    Taken from this link.

提交回复
热议问题