👋Hello guyz,
I want you to checkout my QR Code Scanner on Play Store
source code of my QR code scanner github
In this article I am going to tell you how you can also create your QR code scanner and publish it on Play Store.
Pre-requisite
- Android Studio
- basic idea of java/kotlin
Now it’s time to create our own QR Code in just 5mins.
Why Google Code Scanner
The Google code scanner API provides a complete solution for scanning codes without requiring your app to request camera permission, while preserving user privacy. This is accomplished by delegating the task of scanning the code to Google Play services and returning only the scan results to your app. All image processing occurs on the device and Google doesn't store the results or image data.
Step 1: Add the dependency of a Google code scanner in the build.gradle
Include in your top-level settings.gradle file
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
Add the dependency of a code scanner in the app/build.gradle
dependencies {
implementation 'com.google.android.gms:play-services-code-scanner:16.0.0'
}
Add meta-data in the manifest file so that Google Play services automatically download the scanner module to the device while your app is installed from the Play Store
<application ...>
...
<meta-data
android:name="com.google.mlkit.vision.DEPENDENCIES"
android:value="barcode_ui"/>
...
</application>
Step 2: Code for Scan Code
Get an instance of GmsBarcodeScanner
val scanner = GmsBarcodeScanning.getClient(this)
// Or with a configured options
// val scanner = GmsBarcodeScanning.getClient(this, options)
Request a code scanning by calling startScan()
scanner.startScan()
.addOnSuccessListener { barcode ->
val result: String? = barcode.rawValue
}
.addOnCanceledListener {
// Task canceled
}
.addOnFailureListener { e ->
// Task failed with an exception
}
our basic QR code scanner is ready to scan qr code
you can do further improvement according to your need.
Guyzz don't forget to check my qr code scanner on Play Store
In next article we will learn how to publish our qr code scanner on play store.
Thank you for reading this article. If you found this helpful and interesting, please like and follow me for more such content.
If I got something wrong, mention it in the comments. I would love to improve.
Top comments (0)