Welcome to Scan QR SDK, your premier solution for seamless QR code scanning and validation, with a special focus on Aadhaar QR codes. This guide will walk you through the steps to integrate our library into your Android application effortlessly.
Explore our Scan QR SDK Sample App to see the library in action and get a hands-on experience.
To begin, create an API wrapper to interface with our upload-qr
API. Detailed documentation for this API is available here.
You will need an Authorization Token to use this API. Please contact your account manager to obtain the token.
In your app-level build.gradle
file, add the following dependency:
minSdkVersion 26 // Minimum SDK version required
dependencies {
implementation 'io.surepass.sdk:scan-qr-android-sdk:1.0.0'
}
Update your settings.gradle
file with the following configuration:
pluginManagement {
repositories {
google()
mavenCentral()
jcenter()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
jcenter()
mavenCentral()
// Enter your GitHub username and personal access token
maven {
url = "https://maven.pkg.github.com/surepassio/scan-qr-sdk-sample-app"
credentials {
username = "USER_NAME"
password = "PAT_TOKEN" // https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token
// Ensure the token has read package permissions
}
}
}
}
In the activity or application where you want to integrate the SDK, use the following code:
import io.surepass.scanqr.api.InitScan
import io.surepass.scanqr.interfaces.QRCodeCallback
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.btnGetStarted.setOnClickListener {
// Initiate QR scan and handle the result in the callback
InitScan.startQRScan(this, object : QRCodeCallback {
override fun onQRCodeScanned(result: String) {
Log.d("QRScanner", "Scanned QR Code: $result")
// Implement your API wrapper here to process Aadhaar QR details
}
})
}
}
}
Upon integration, the SDK will open the camera to scan QR codes. The scanned QR details will be available in the onQRCodeScanned
callback. Implement your API wrapper in this callback to handle Aadhaar QR details.
InitScan.startQRScan(this, object : QRCodeCallback {
override fun onQRCodeScanned(result: String) {
Log.d("QRScanner", "Scanned QR Code: $result")
// Implement your API wrapper here to process Aadhaar QR details
}
})
After successfully integrating the library and implementing the API wrapper, your Android application will be capable of scanning QR codes with ease.
For support or contributions, feel free to reach out for integration support at [email protected].